• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

creating and parsing csv files

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone written any code to create or parse CSV files? I saw a post awhile back about some freeware, but I'm not sure
I can use that for commercial purposes. (Also, some of the source code was omitted, and unfortunately the classes I needed didn't compile.)
From what I've read, Java's StringTokenizer and StreamTokenizer are not really designed to deal with comma-separated flat files.
Yes, I can write it myself, but I thought why reinvent the wheel if there is code out there, especially for something as common as handling csv files.
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main problem with using StringTokenizer with CSV files is that the StringTokenizer eats all the tokens that occur next to one another. So, if there are two commas in a row, it basically skips a column.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you use Regular Expressions I'm sure it would make your life a lot easier if you do have to implement it.
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use a jdbc driver for csv files. There are many free ones out there.

-Yoo-Jin
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic