Golang bufio.Split() function example
package bufio
Split sets the split function for the Scanner. If called, it must be called before Scan. The default split function is ScanLines.
Golang bufio.Split() function usage example
reader := bufio.NewReader(file)
scanner := bufio.NewScanner(reader)
scanner.Split(bufio.ScanLines) // Split
for scanner.Scan() {
fmt.Println(scanner.Text())
}
Advertisement
Something interesting
Tutorials
+16.3k Golang : Find out mime type from bytes in buffer
+13.5k Golang : How to get year, month and day?
+80.6k Golang : How to return HTTP status code?
+18.5k Golang : Set, Get and List environment variables
+7.7k Gogland : Where to put source code files in package directory for rookie
+19.8k Golang : Append content to a file
+23.7k Find and replace a character in a string in Go
+6.5k Elasticsearch : Shutdown a local node
+7.3k Golang : Fixing Gorilla mux http.FileServer() 404 problem
+12.8k Golang : Listen and Serve on sub domain example
+5.2k Golang : The Tao of importing package
+16k Golang : Get sub string example