encoding.csv #

Reader example

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 #

fn new_reader(data string) &Reader

new_reader initializes a Reader with string data to parse

fn new_writer #

fn new_writer() &Writer

fn (Reader) read #

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 (Writer) write #

fn (mut w Writer) write(record []string) ?bool

write writes a single record

fn (Writer) str #

fn (mut w Writer) str() string