csv
csv parses CSV-style delimited text into rows and fields.
With the default comma delimiter, parseDocument() implements RFC 4180 record and quoted-field
parsing, including embedded CRLF, doubled-quote escaping, consistent field counts, and explicit
parse errors for malformed input.
It also supports a few explicit extensions: alternate delimiters, optional empty-line skipping, and LF-only line endings.
Usage
| |
API
parseLine(allocator, line, delimiter)
Parse one line and return a newly allocated slice of fields.
parseDocument(allocator, input, options)
Parse a whole input buffer and return a Document:
rows: parsed rowsnum_cols: column count inferred from the first parsed row
Malformed input returns a parse error such as error.InvalidQuotedField,
error.InvalidRecordTerminator, error.InconsistentFieldCount, or
error.UnclosedQuotedField.
Document owns the row and field storage. Call document.deinit(allocator) when you are done with
it.