Standard library
CSV
Thin CSV line and multi-line helpers.
Introduction
Thin CSV line and multi-line helpers. Import std/encoding/csv to bind the module as csv. Call free functions as csv.name(...). Struct methods use a receiver value.
/ std/encoding/csv
This page is the package reference for std/encoding/csv. Private helpers used only by co-located tests are not listed.
Functions
Free functions on csv. Each function has a short description, an example, then parameters and return shape.
parse_line
Splits one CSV line into fields. Call form: csv.parse_line(s).
/ std/encoding/csv
$ fields = csv.parse_line("a,b,c")Parameters: s: CSV line text. Returns: List of field strings.
parse
Parses multi-line CSV text into rows. Call form: csv.parse(s).
/ std/encoding/csv
$ rows = csv.parse("a,b\n1,2\n")Parameters: s: CSV document text. Returns: List of rows (each a list of fields).
format_line
Formats a list of fields as one CSV line. Call form: csv.format_line(fields).
/ std/encoding/csv
$ line = csv.format_line(["a", "b"])
Parameters: fields: list of field strings. Returns: CSV line string.