Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading A Character then the next  RSS feed

 
Aaron Mcgrath
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possable to read a character in a line, then read the next then the next etc.. till there are no more characters.

then just go to the next line
?

thanks in advance guys.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use FileReader to read files a character at a time. If you need to know when you have a hit a new line, you will need to check for the appropriate character code.

Alternatively, you could use a BufferedReader to read a whole line at once, and then iterate through the returned String using the charAt(int i) method.
 
Choon-Chern Lim
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!