Comma-separated values (CSV) are a popular text format to interchange data. Gforth provides words for reading CSV files (with all features, including newlines in quoted strings).
Read the CSV file with the name given by c-addr u and
execute xt for every field found.
Xt (
c-addr2 u2 field line -- ) is called once for each field;
c-addr2 u2 is the decoded field content, field is the
field number (starting with 0), and line is the line number
(starting with 1).
CSV field separator (default is ‘,’, hence the name
"comma-separated"); this is a value and can be
changed with to csv-separator.
CSV quote character (default is "); this is a value and can be
changed with to csv-quote.
print a field in CSV format, i.e., with enough quotes that
read-csv will produce c-addr u when encountering the
output of .quoted-csv.