CSV parsing .. once again

Posted by Mike Haller on Sunday, December 31. 2006 at 17:11 in Java
Who hasn't dealt with comma separated values? These damn little .csv files. Okay, there are a few Java libraries to handle CSV files, such as the Ostermiller lib. However, it's not usable in some environments (e.g. licensing conflict).

"1000";1;;"0";"1000";;9;2000;"1000";"Sonstiges";"Stck";;1,00;1754" "1001";1;;"0";"1000";;9;2000;"1000";"Sonstiges";"Stck";;1,00;584" "1002";1;;"0";"1001";;9;2000;"1000";"Sonstiges";"Stck";;1,00;255"


Then, in a new Java project, one is undecided whether to write a small importer which just fits the one .csv file you need to import. Then, there will always be another one and yet another one. Oh, and then there are the charset problems. Does the file originate from a legacy DOS application, a legacy Windows application? Or is it totally weird, because csv is only a de-facto standard and you cannot find a real specification anywhere? How do you handle the empty values with no quotes?

At that time, it'd be good to have a Java CSV library within reach.

Apache has the commons-csv library, and hopefully it gets out of the sandbox soon and will be merged with an existing library such as commons-lang or commons-io.


Johannes Buehler
mabe Jsefa is interesting for you as well. JSefa is a high level API for parsing xml, csv ...

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications
 
 

About

My name is Mike Haller and I'm a software developer and architect at Innovations Software Technology in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development.

Quicksearch