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
+4.6k Linux : sudo yum updates not working
+9.7k Golang : Load ASN1 encoded DSA public key PEM file example
+7.5k Golang : Rename part of filename
+7.5k Golang : How to stop user from directly running an executable file?
+9.4k Golang : Terminate-stay-resident or daemonize your program?
+17.1k Golang : Capture stdout of a child process and act according to the result
+9.7k PHP : Get coordinates latitude/longitude from string
+7.6k Javascript : Push notifications to browser with Push.js
+5.2k Python : Create Whois client or function example
+13.7k Golang : Check if an integer is negative or positive
+19.7k Golang : Archive directory with tar and gzip
+7.1k Golang : Transform lisp or spinal case to Pascal case example