@std/csv.ms#
Import each required symbol with import Name from "@std/csv.ms".
CsvError Alternative#
Errors returned for malformed CSV input or configured size limits.
type CsvError:
case InvalidInput
case InvalidData
case LimitExceededimpl Error for CsvError:
fn message() -> String:CsvError.InvalidData#
Quoting or another CSV record syntax rule is violated by the input.
case InvalidDataCsvError.InvalidInput#
The delimiter, line ending or a supplied row/cell/output budget is invalid.
case InvalidInputCsvError.LimitExceeded#
Parsed row/cell counts or the encoded output exceed a supplied budget.
case LimitExceededCsvError.Error.message#
Returns a CSV-prefixed diagnostic without exposing input cells or parser text.
fn message() -> String:CsvOptions Record#
Delimiter and line ending used when parsing or writing CSV; defaults are comma and LF.
type CsvOptions:
delimiter: String = ","
line_ending: String = "\n"CsvOptions.delimiter#
One non-NUL ASCII delimiter other than quote, CR or LF; defaults to comma.
delimiter: String = ","CsvOptions.line_ending#
Row terminator for encoding, either LF or CRLF; defaults to LF.
line_ending: String = "\n"parse Function#
Parses CSV into rows of cells, using fresh default options when omitted. Optional row and cell limits bound large inputs.
fn parse(text: String, options: CsvOptions = CsvOptions(), max_rows: Optional[Int] = none, max_cells: Optional[Int] = none) -> Result[List[List[String]], CsvError]:stringify Function#
Encodes rows as CSV with comma delimiters and LF endings by default. Quotes cells when required by the delimiter or line ending.
fn stringify(rows: List[List[String]], options: CsvOptions = CsvOptions(), max_bytes: Optional[Int] = none) -> Result[String, CsvError]: