CSV
One of the most common ways a file is structured is as a comma-separated value. This is a clear text file that contains data, which is basically represented as rows and columns. Frequently, these files are used to exchange data. A CSV file has a simple structure. Each piece of data is separated by a comma and then a new line for another record. An example of a CSV file would be as follows:
firstName, lastName, age Celina, Jones, 18 Cailyn, Henderson, 13 Cayden, Smith, 42
- You will, at some point in your life, come across CSV files as they are very common. The Go programming language has a standard library that is used for handling CSV files:
encoding/csv
:
package main import ( "encoding/csv" "fmt" "io" "log" "strings" ) func main() { in := `firstName, lastName, age Celina, Jones, 18 Cailyn, Henderson, 13 Cayden, Smith, 42 ` r ...