Golang bufio.Reset() function example
package bufio
Reset discards any buffered data, resets all state, and switches the buffered reader to read new input
Golang bufio.Reset() function usage example
readbuffer := bytes.NewBuffer([]byte("abcde#fghijk"))
reader := bufio.NewReader(readbuffer)
before, _ := reader.ReadString('#') // # is the delimiter
fmt.Println(string(before))
reader.Reset(readbuffer)
after, _ := reader.ReadString('#')
fmt.Println(string(after))
Output :
abcde#
_______
Note: _______ means empty spaces
Reference :
Advertisement
Something interesting
Tutorials
+11.9k Golang : How to parse plain email text and process email header?
+12.3k Golang : Flush and close file created by os.Create and bufio.NewWriter example
+36k Golang : Get file last modified date and time
+8.7k Golang : How to join strings?
+5k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+5.6k Python : Print unicode escape characters and string
+16.7k Golang : Gzip file example
+8.5k Linux/Unix : fatal: the Postfix mail system is already running
+12.1k Golang : convert(cast) string to integer value
+6.9k Mac OSX : Find large files by size
+9.1k Golang : Simple histogram example