library: bufio, encoding/csv
This commit is contained in:
@@ -278,6 +278,7 @@ Here are the Go packages that can be imported correctly:
|
|||||||
* [flag](https://pkg.go.dev/flag)
|
* [flag](https://pkg.go.dev/flag)
|
||||||
* [sort](https://pkg.go.dev/sort)
|
* [sort](https://pkg.go.dev/sort)
|
||||||
* [bytes](https://pkg.go.dev/bytes)
|
* [bytes](https://pkg.go.dev/bytes)
|
||||||
|
* [bufio](https://pkg.go.dev/bufio)
|
||||||
* [strings](https://pkg.go.dev/strings)
|
* [strings](https://pkg.go.dev/strings)
|
||||||
* [strconv](https://pkg.go.dev/strconv)
|
* [strconv](https://pkg.go.dev/strconv)
|
||||||
* [path](https://pkg.go.dev/path)
|
* [path](https://pkg.go.dev/path)
|
||||||
@@ -295,6 +296,7 @@ Here are the Go packages that can be imported correctly:
|
|||||||
* [encoding/hex](https://pkg.go.dev/encoding/hex)
|
* [encoding/hex](https://pkg.go.dev/encoding/hex)
|
||||||
* [encoding/base32](https://pkg.go.dev/encoding/base32)
|
* [encoding/base32](https://pkg.go.dev/encoding/base32)
|
||||||
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
||||||
|
* [encoding/csv](https://pkg.go.dev/encoding/csv)
|
||||||
* [regexp](https://pkg.go.dev/regexp)
|
* [regexp](https://pkg.go.dev/regexp)
|
||||||
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)
|
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)
|
||||||
|
|
||||||
|
|||||||
30
_cmptest/csvdemo/csv.go
Normal file
30
_cmptest/csvdemo/csv.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/csv"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
in := `first_name,last_name,username
|
||||||
|
"Rob","Pike",rob
|
||||||
|
Ken,Thompson,ken
|
||||||
|
"Robert","Griesemer","gri"
|
||||||
|
`
|
||||||
|
r := csv.NewReader(strings.NewReader(in))
|
||||||
|
|
||||||
|
for {
|
||||||
|
record, err := r.Read()
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(record)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user