Answer to Question #33626 in Java | JSP | JSF for Ashan

Question #33626
To load a text-file, read it line by line, and return the
total number of alphanumeric tokens it contains and skip over the comments and double-quoted strings
in the text-file while you are processing it
1
Expert's answer
2013-08-15T08:42:05-0400
BufferedReader fin = new BufferedReader( new InputStreamReader(new FileInputStream("test.txt"),"windows-1251"));
List<String> fileContent = new ArrayList<String>() ;
String str ;
while( (str = fin.readLine() ) != null )
fileContent.add(str) ;
fin.close() ;


To skip over the comments and double-quoted strings


in the text-file while you are processing it, you should use class StringTokenizer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS