6 Replies Last post: Sep 8, 2002 11:02 PM by Maxim Shafirov  
Currently Being Moderated

Sep 8, 2002 10:40 AM

Best way to get lines in a Document?

I've just started getting into the Open API, so I apologize in advance if

this is a stupid question... (coding at 2 AM probably doesn't help either


What's the best way to tokenize a Document into individual lines?  I've

found the getLineCount() method to get the number of lines, but i'd like to

know the best way to iterate over each line.


Should I just wrap the char array returned by doc.getChars() with a

CharArrayReader and BufferedReader like this:


   CharArrayReader stringReader = new CharArrayReader(doc.getChars());

   BufferedReader in = new BufferedReader(stringReader);


So that I could later call in.readLine() in a loop?


Or is there a better way?









More Like This

  • Retrieving data ...