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
Comments
Leave a comment