Golang encoding/csv.ParseError.Error() function example
package encoding/csv
A ParseError is returned for parsing errors. The first line is 1. The first column is 0.
Golang encoding/csv.ParseError.Error() function usage example
package main
import (
"encoding/csv"
"fmt"
"strings"
)
func main() {
// simulate a deformed csv data
csvreader := csv.NewReader(strings.NewReader("item2,item3,item4,item5\nitem6,"))
_, err := csvreader.ReadAll()
if err != nil {
fmt.Println(err.Error())
}
}
Output :
line 2, column 0: wrong number of fields in line
Reference :
Advertisement
Something interesting
Tutorials
+12.9k Python : Convert IPv6 address to decimal and back to IPv6
+8.2k Golang : Routes multiplexer routing example with regular expression control
+11.6k Golang : Simple file scaning and remove virus example
+7.4k Linux : How to fix Brother HL-1110 printing blank page problem
+7.5k Golang : Gorrila set route name and get the current route name
+36.3k Golang : Convert(cast) int64 to string
+10.7k Golang : Underscore string example
+4.7k Golang : How to pass data between controllers with JSON Web Token
+7.5k Golang : Detect sample rate, channels or latency with PortAudio
+12.8k Swift : Convert (cast) Int or int32 value to CGFloat
+32.7k Golang : Regular Expression for alphanumeric and underscore
+12.2k Golang : Get remaining text such as id or filename after last segment in URL path