From 816c652997957f037093328fdb6180417f77d8e9 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Wed, 31 Jul 2013 20:03:02 +0000 Subject: [PATCH] Better example. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1509012 13f79535-47bb-0310-9956-ffa450edef68 --- src/site/xdoc/index.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index 9cf8253e..a1c3ced4 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -25,13 +25,14 @@ limitations under the License.

Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.

To parse an Excel CSV file, write:

- Reader in = ...; + Reader in = new FileReader("path/to/file.csv"); Iterable<CSVRecord> parser = CSVFormat.EXCEL.parse(in); for (CSVRecord record : parser) { - ... + String lastName = record.get("Last Name"); + String firstName = record.get("First Name"); }

Other formats are available, please consult the Javadoc for CSVFormat and - CSVParser

+ CSVParser.