Author: ggregory Date: Wed Jul 31 20:03:02 2013 New Revision: 1509012 URL: http://svn.apache.org/r1509012 Log: Better example.
Modified: commons/proper/csv/trunk/src/site/xdoc/index.xml Modified: commons/proper/csv/trunk/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/site/xdoc/index.xml?rev=1509012&r1=1509011&r2=1509012&view=diff ============================================================================== --- commons/proper/csv/trunk/src/site/xdoc/index.xml (original) +++ commons/proper/csv/trunk/src/site/xdoc/index.xml Wed Jul 31 20:03:02 2013 @@ -25,13 +25,14 @@ limitations under the License. <section name="Using Commons CSV"> <p>Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.</p> <p>To parse an Excel CSV file, write:</p> - <source>Reader in = ...; + <source>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"); }</source> <p>Other formats are available, please consult the Javadoc for <a href="apidocs/org/apache/commons/csv/CSVFormat.html">CSVFormat</a> and - <a href="apidocs/org/apache/commons/csv/CSVParser.html">CSVParser</a></p> + <a href="apidocs/org/apache/commons/csv/CSVParser.html">CSVParser</a>.</p> </section> <section name="Getting the code">