std::encoding::csvCSV parsing โ pure Hew implementation.
Parse CSV data from strings or files into a table that can be queried by row/column index or column name.
import std.encoding.csv;
fn main() {
match csv.parse("name,age\nAlice,30\nBob,25") {
.Ok(table) => println(table.get_by_name(0, "name")), // "Alice"
.Err(error) => println(error),
}
}
parseParse CSV data from a string (first row is treated as headers).
Returns Err(string) if the input is not well-formed CSV. A malformed
quote state is a failure, not a repairable shape: an unterminated quoted
field otherwise parses as a complete table, which is exactly what a
truncated file must not look like.
parse_no_headersParse CSV data from a string without treating the first row as headers.
Returns Err(string) if the input is not well-formed CSV.
parse_fileParse CSV data from a file path (first row is treated as headers).
Returns Err(string) if the file cannot be read or the input is not
well-formed CSV.
TableMethodsMethods available on a CSV Table.
Return the number of data rows (excluding the header row).
Return the number of columns.
Return the header name for the given column index.
Return the cell value at the given row and column index.
Return the cell value at the given row for the named column.