Read a CSV file

Comma-Separated Value (CSV) file, it’s likely that applications like Excel export spreadsheets into CSV file or a custom application program encode it data into CSV format for you. I assumed you getting in UTF-8 encoded. Instead of hard coding the filenames into the source code, filename will pass into the progam as parameters (arguments) Public… Continue reading Read a CSV file

Categorized as csv

Regular Expression

regrex package On-line Regular Expression Meta Characters Metacharacters are characters that are interpreted in a special way by a RegEx engine. Here’s a list of metacharacters: [] . ^ $ * + ? {} () \ | [] – Square brackets Square brackets specifies a set of characters you wish to match. . – Period A period matches any single character (except newline ‘\n’).  – Caret The caret… Continue reading Regular Expression

func Split func Split(s, sep string) []string Split slices s into all substrings separated by sep and returns a slice of the substrings between those separators. If s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s. If sep is empty, Split splits after… Continue reading

Categorized as strings

os package with reading an open file and error log

the os package import a few other packages. file, err := os.Open(“file.go”) // For read access. if err != nil { log.Fatal(err) } Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it… Continue reading os package with reading an open file and error log

What is a buffer?

Send data to a buffer (system memory) and will not write until it reaches the length. After which it writes the data and flushes the buffer.