20 lines
237 B
Markdown
20 lines
237 B
Markdown
|
## Reader example
|
||
|
|
||
|
```v
|
||
|
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']
|
||
|
```
|