%bte.doc super="item.bte" %> <%bte.tpl name=pageTitle%>Labeled Comma Separated Values (CSV)<%/bte.tpl%> <%bte.tpl name=description%>Read a CSV file and treat the first line as column titles.<%/bte.tpl%> <%bte.tpl name=keywords%>labeled csv parser, labeledcsvparser, java labeled csv, comma separated values with labels, java csv labeled, column headings on csv<%/bte.tpl%> <%bte.tpl name=content%>
LabeledCSVParser lcsvp = new LabeledCSVParser( new CSVParser( new StringReader( "Name,Phone\n" + "Stewart,212-555-3233\n" + "Cindy,212-555-8492\n" ) ) ); while(lcsvp.getLine() != null){ System.out.println( "Name: " + lcsvp.getValueByLabel("Name") ); System.out.println( "Phone: " + lcsvp.getValueByLabel("Phone") ); }
The labeled CSV parser allows you to use either the CSV or the Excel CSV parsers, treating them as if the first line were the column headings.
[Download /w Source | Version History | Browse Source | Documentation]