ocean.text.csv.CSV

Class for parsing streams of CSV data.

Currently the class is capable of parsing only fairly simple, well-formatted CSV. The following basic format features are supported:

* Newline (\n) separated lines. * Comma (or arbitrary character) -separated fields. * Quoted fields (a " character, followed by any number of characters, and delimited by another " and a separator character). Separators (commas) and newlines (\n) may both appear inside quoted fields.

Usage:

import ocean.io.Stdout;
import ocean.io.device.File;

scope file = new File("example.csv", File.ReadExisting);
scope csv = new CSV;

csv.parse(file,
(char[][] fields)
{
    Stdout.formatln("Row={}", fields);
    return true; // tells CSV instance to continue parsing
});

Members

Classes

CSV
class CSV

Simple CSV parser. Passes extracted fields, one row at a time to a user-provided delegate.

Meta

License

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).