Class for parsing streams of CSV data with handling of column headings. The
fields of the first row are parsed as the column headings. The user delegate
passed to the parse() methods receives the values of the fields in a row
together with the corresponding column headings, read from the first row.
A second parse() method allows only certain columns in the CSV stream to be
processed.
See ocean.text.csv.CSV for details on the basic format support of the
parser.
Usage:
importocean.io.Stdout;
importocean.io.device.File;
scopefile = newFile("example.csv", File.ReadExisting);
scopecsv = newHeadingsCSV;
constinclude_headings = ["Criteria ID", "Country Code", "Canonical Name"];
// Parse method allowing only certain columns to be passed to the// delegate.csv.parse(file, include_headings,
(HeadingsCSV.Field[] fields)
{
Stdout.format("Row=[");
foreach ( f; fields )
{
Stdout.format("{}:{}, ", f.name, f.value);
}
Stdout.formatln("]");
returntrue; // tells CSV instance to continue parsing
});
CSV parser with special handling of column headings. Passes extracted
fields, one row at a time to a user-provided delegate, along with the column
heading of each field.
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
Alternatively, this file may be distributed under the terms of the Tango
3-Clause BSD License (see LICENSE_BSD.txt for details).
Class for parsing streams of CSV data with handling of column headings. The fields of the first row are parsed as the column headings. The user delegate passed to the parse() methods receives the values of the fields in a row together with the corresponding column headings, read from the first row.
A second parse() method allows only certain columns in the CSV stream to be processed.
See ocean.text.csv.CSV for details on the basic format support of the parser.
Usage: