Search results

There are no results.

std.csv

Parsing and generating of CSV data.

This module provides support for parsing and generating RFC 4180 compliant CSV data.

Examples

Parsing CSV data:

import std.csv (Parser)
import std.io (Buffer)

let parser = Parser.new(Buffer.new('foo,bar'))
let rows = parser
  .try_reduce([], fn (rows, res) {
    rows.push(try res)
    Result.Ok(rows)
  })
  .get

rows # => [['foo', 'bar']]

Generating CSV data:

import std.csv (Generator)
import std.stdio (Stdout)

let gen = Generator.new(Stdout.new)

gen.write(['foo', 'bar'])

Classes

Error

An error produced when parsing a CSV stream.

ErrorKind

A type indicating what kind of error is produced.

Generator

A type for generating CSV data.

Parser

A type for parsing a CSV stream.

Separator

A type describing the column separator.