Golang encoding/csv.NewReader() function example
package encoding/csv
NewReader returns a new Reader that reads from r (1st parameter).
Golang encoding/csv.NewReader() function usage example
package main
import (
"encoding/csv"
"fmt"
"strings"
)
func main() {
// simulate deformed csv data
csvreader := csv.NewReader(strings.NewReader("item1,item2,item3,item4,item5\nitem6,"))
_, err := csvreader.ReadAll()
if err != nil {
fmt.Println(err.Error())
}
}
For reading from CSV file, please see https://www.socketloop.com/tutorials/read-csv-file-go
Reference :
Advertisement
Something interesting
Tutorials
+10.3k Golang : Convert file content to Hex
+25k Golang : Create PDF file from HTML file
+13.4k Golang : Get constant name from value
+10.2k Golang : Use regular expression to get all upper case or lower case characters example
+17k Golang : Covert map/slice/array to JSON or XML format
+19.9k Golang : Count JSON objects and convert to slice/array
+12.4k Elastic Search : Return all records (higher than default 10)
+6.2k Golang : Process non-XML/JSON formatted ASCII text file example
+13.6k Golang : Qt progress dialog example
+9.3k Golang : Temperatures conversion example
+7.3k Golang : How to fix html/template : "somefile" is undefined error?