d4_dsv 1.0.0 copy "d4_dsv: ^1.0.0" to clipboard
d4_dsv: ^1.0.0 copied to clipboard

A parser and formatter for delimiter-separated values, such as CSV and TSV.

Dart CI pub package package publisher

A parser and formatter for delimiter-separated values, such as CSV and TSV.

These tabular formats are popular with spreadsheet programs such as Microsoft Excel, and are often more space-efficient than JSON. This implementation is based on RFC 4180.

Comma (CSV) and tab (TSV) delimiters are built-in. For example, to parse:

csvParse("foo,bar\n1,2"); // ([{foo: 1, bar: 2}], columns: [foo, bar])
tsvParse("foo\tbar\n1\t2"); // ([{foo: 1, bar: 2}], columns: [foo, bar])

Or to format:

csvFormat([{"foo": "1", "bar": "2"}]); // "foo,bar\n1,2"
tsvFormat([{"foo": "1", "bar": "2"}]); // "foo\tbar\n1\t2"

To use a different delimiter, such as “|” for pipe-separated values, use DsvFormat:

final psv = DsvFormat("|");

print(psv.parse("foo|bar\n1|2")); // ([{foo: 1, bar: 2}], columns: [foo, bar])
2
likes
140
points
73
downloads

Publisher

verified publisherluizbarboza.com

Weekly Downloads

A parser and formatter for delimiter-separated values, such as CSV and TSV.

Repository (GitHub)
View/report issues

Documentation

API reference

License

ISC (license)

More

Packages that depend on d4_dsv