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
+6.3k Golang : Selection sort example
+23k Golang : Calculate time different
+7.1k Golang : Get environment variable
+15.8k Golang : Get digits from integer before and after given position example
+12.1k Golang : convert(cast) string to integer value
+19.4k Golang : How to count the number of repeated characters in a string?
+7.8k Golang : Regular Expression find string example
+7.9k Golang : Trim everything onward after a word
+18.4k Golang : Read binary file into memory
+5.4k Golang : Qt update UI elements with core.QCoreApplication_ProcessEvents
+15.3k Golang : Get query string value on a POST request