All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.Ostermiller.util.LabeledCSVParser.bte Maven / Gradle / Ivy

Go to download

Open source (GPL) Java utilities maintained by Stephen Ostermiller with help from many contributors.

The newest version!
<%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=topcontent%>
Decorates either a href="CSV.html">CSV or the Excel CSV parsers such that the first row read is a row of labels.
<%/bte.tpl%>
<%bte.tpl name=content%>

Example

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")
    );
}

CSV with column headings: LabeledCSVParser

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.

<%/bte.tpl%> <%bte.tpl name=linkLabeledCSVParser%>Labeled CSV Parser <%/bte.tpl%> <%/bte.doc%>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy