• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to read CSV?  RSS feed

 
Gary kwlai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I make the program to read CSV without the space and the "," and passed down each word into a variables?

thanks
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by reading Accessing File Formats.
 
Gary kwlai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Start by reading Accessing File Formats.


Without rely on third-party library how would I code it in such a way can read the csv?
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use a 3rd party library? Those listed have proved to be working correctly; why reinvent the wheel?
 
Gary kwlai
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Why not use a 3rd party library? Those listed have proved to be working correctly; why reinvent the wheel?


nothing wrong with the third party library, but as for learning purposes it is better to know how to do
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be sure to handle all the edge cases, like cell contents that include single and double quotes, quotes within quotes, newlines within content, etc. Also be aware that CSV cells can be separated by semicolons instead of commas (yes, despite the name), particularly in locales that use the comma to separate integer values from the decimals.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!