std.csv
rfc 4180 reader; sep ‘,’ ‘;’ or tab; LF/CRLF; skips empty lines and a bom fields are slices of the text; only a quoted field with “” is copied into the arena
CsvError
Section titled “CsvError”pub CsvError :: errors { unterminated_quote,}unterminated_quote: a field in quotes runs to the end of the text
CsvReader
Section titled “CsvReader”pub CsvReader :: struct { text: []const u8, at: usize, sep: u8, line: usize, breaks: usize,}not Reader: would clash with std.io’s (modules share one type namespace)
at: where the next record startsline: the line the last record started on, from 1breaks: the line breaks read so far
CsvReader.done
Section titled “CsvReader.done”pub done :: fn(self: *Self) -> booltrue once every record is read
CsvReader.next
Section titled “CsvReader.next”pub next :: fn(self: *Self, a: *Arena) -> [][]const u8 ! CsvErrornext record’s fields, in a; empty when done
reader
Section titled “reader”pub reader :: fn(text: []const u8, sep: u8) -> CsvReaderreader over text; sep 44 ‘,’, 59 ‘;’, 9 tab
records
Section titled “records”pub records :: fn(text: []const u8, sep: u8, a: *Arena) -> [][][]const u8 ! CsvErrorall records, fields in a
guess_separator
Section titled “guess_separator”pub guess_separator :: fn(text: []const u8) -> u8most common of ‘;’ tab ‘,’ on line 1, outside quotes; ‘,’ if none