opencsv: Open Source Java CSV Library
By admin on Aug 1, 2008 in Java, open source
OpenCSV is a Java CSV parser library.
opencsv supports all the basic csv-type things you’re likely to want to do:
- Arbitrary numbers of values per line
- Ignoring commas in quoted elements
- Handling quoted entries with embedded carriage returns (ie entries that span multiple lines)
- Configurable separator and quote characters (or use sensible defaults)
- Read all the entries at once, or use an Iterator style model
- Creating csv files from String[] (ie. automatic escaping of embedded quote chars)
Sample code
CSVReader reader = new CSVReader(new FileReader("yourfile.csv"));
String [] nextLine;
while ((nextLine = reader.readNext()) != null) {
// nextLine[] is an array of values from the line
System.out.println(nextLine[0] + nextLine[1] + "etc...");
}
Popularity: 1% [?]
Post a Comment