Ostermillerutil Java Utilities Labeled Comma Separated Values (CSV) - com.Ostermiller.util Java Utilities

Decorates either a href="CSV.html">CSV or the Excel CSV parsers such that the first row read is a row of labels.

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.


License

OstermillerUtil Java Utilities Copyright (c) 2001-2007 by Stephen Ostermiller and other contributors

The OstermillerUtils library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

License FAQs - Why GPL? How about the LGPL or something else?