• Post Reply Bookmark Topic Watch Topic
  • New Topic

parsing text file  RSS feed

 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was parsing a text file by reading it line by line and using string tokenizer with tab delim. The format of the line is like
"kundan" tab "verma" tab "india"
so using stringTokenizer("/t")
but now i am getting tab inside double quotes like "kundan " so stringtokeniser tokenise data inside double quotes also. How to get rid of this problem.

Please suggest,

Regards,
Kundan
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks very much like a CSV file with tabs instead of commas.

In the Accessing File Formats, under the Excel section, you can find some libraries that can handle CSV files. Both Ostermiller Utils' CSVParser and opencsv's CSVReader allow you to specify both the separator / delimiter and quote character. With those it should be quite easy.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!