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
+12.8k Golang : Convert int(year) to time.Time type
+7.4k Golang : Scanf function weird error in Windows
+19.2k Golang : Delete item from slice based on index/key position
+7.4k Golang : Convert source code to assembly language
+33.6k Golang : How to check if slice or array is empty?
+5.6k PHP : Convert CSV to JSON with YQL example
+6.6k Golang : How to validate ISBN?
+12.3k Golang : Get month name from date example
+10.6k Golang : Flip coin example
+25.6k Golang : convert rune to integer value
+17.9k Golang : Qt image viewer example
+16k Golang : Read large file with bufio.Scanner cause token too long error