...
Package csv
▾ Example
Code:
csvmap, k := csv.LoadCSVfromString(userdata)
for _, user := range csvmap {
fmt.Println(user[k["email"]])
}
▾ Example (Fourth)
Code:
csvmap, k := csv.LoadCSVfromFile("./test.csv")
for _, user := range csvmap {
fmt.Println(user[k["email"]])
}
Output:
jDoe@example.org
▾ Example (Second)
Code:
csvmap, k := csv.LoadCSVfromFile("./test.csv")
for _, user := range csvmap {
fmt.Println(user[k["email"]])
}
▾ Example (Third)
Code:
csvmap, k := csv.LoadCSVfromString(userdata2)
for _, user := range csvmap {
fmt.Println(user[k["email"]])
}
Output:
jDoe@example.org
func GetHead(data map[int][]string) map[string]int
GetHead returns a map which represents the head of a csv map
func LoadCSVfromFile(filename string) (map[int][]string, map[string]int)
LoadCSVfromFile parses a CSV from a file and returns two maps
one map with the data and another one with the csv head
func LoadCSVfromString(csv string) (map[int][]string, map[string]int)
LoadCSVfromString parses a CSV from a string and returns two maps
one map with the data and another one with the csv head