import encoding.csv
data := 'x,y\na,b,c\n'
mut parser := csv.new_reader(data)
// read each line
for {
items := parser.read() or { break }
println(items)
}
It prints:
['x', 'y']
['a', 'b', 'c']
fn new_reader(data string) &Reader
new_reader initializes a Reader with string data to parse
fn new_writer() &Writer
fn (mut r Reader) read() ?[]string
read reads a row from the CSV data. If successful, the result holds an array of each column's data.
fn (mut w Writer) write(record []string) ?bool
write writes a single record
fn (mut w Writer) str() string