2020-11-14 18:49:36 +01:00
|
|
|
## Reader example
|
|
|
|
|
|
|
|
```v
|
|
|
|
import encoding.csv
|
|
|
|
|
|
|
|
data := 'x,y\na,b,c\n'
|
|
|
|
mut parser := csv.new_reader(data)
|
|
|
|
// read each line
|
|
|
|
for {
|
2020-12-05 22:54:41 +01:00
|
|
|
items := parser.read() or { break }
|
|
|
|
println(items)
|
2020-11-14 18:49:36 +01:00
|
|
|
}
|
|
|
|
```
|
2020-12-05 22:54:41 +01:00
|
|
|
|
2020-11-14 18:49:36 +01:00
|
|
|
It prints:
|
|
|
|
```
|
|
|
|
['x', 'y']
|
|
|
|
['a', 'b', 'c']
|
|
|
|
```
|