Functions
Quotes field (doubling embedded quotes) when it contains a comma, quote, or newline; returns it unchanged otherwise.
field: Field text to quote if it needs it.
println(std.csv.escape_field("moon, language")) // "moon, language"
println(std.csv.to_row(["moon", "language,tour"]))
println(std.csv.parse_row("moon,\"language,tour\""))Splits one record into fields: commas separate, "..." quotes protect separators, "" inside quotes is a literal quote, bare \r outside quotes is dropped.
line: One record, without its terminating newline.
One record: fields joined by commas, each escaped like escape_field.
fields: Field values for one record, in column order.
Parses a whole document into records of fields. Records split on newlines outside quotes; empty records are dropped.
text: A whole document; records split on newlines outside quotes.
let rows = std.csv.parse_csv("name,year\nmoon,2026")
println(std.csv.row_count(rows))
println(std.csv.col_count(rows))
println(std.csv.get_column(rows, 0))
println(std.csv.to_csv(rows))Rows joined by \n, each rendered like to_row. No trailing newline.
rows: Records to render, each a list of field values.
Column col from each row that has it (rows too short are skipped).
rows: Records to read down.col: Zero-based column index; rows too short are skipped.
The number of records.
rows: Records to count.
The first record's field count (0 when there are no records).
rows: Records whose first row sets the width.