Original post

I’m learning how to use the Scanner in based off of https://golang.org/src/bufio/example_test.go and I would like to know is there a way to restart the scanner? For example if I have two lines:




and use scanner := bufio.NewScanner(os.Stdin) for it to scan the lines of input. Then I want to use it again to scan but just the first line. Is there a simple way to reset it, for example if the first line dynamically changes and I need a specific value somewhere?

submitted by /u/hojpodge
[link] [comments]