Golang fmt.Sscan() function example
package fmt
Sscan scans the argument string, storing successive space-separated values into successive arguments. Newlines count as space. It returns the number of items successfully scanned. If that is less than the number of arguments, err will report why.
Golang fmt.Sscan() function usage example
package main
import "fmt"
func main() {
answers := "1 0 8"
var a, b, c int
fmt.Sscan(answers, &a, &b, &c)
fmt.Println(a, b, c)
}
Output :
1 0 8
Reference :
Advertisement
Something interesting
Tutorials
+14k Golang : concatenate(combine) strings
+10.8k Golang : Natural string sorting example
+6.1k Golang : Scan forex opportunities by Bollinger bands
+13.9k Golang : How to determine if a year is leap year?
+7.9k Golang : Get today's weekday name and calculate target day distance example
+36.5k Golang : Save image to PNG, JPEG or GIF format.
+55.3k Golang : Unmarshal JSON from http response
+26.1k Mac/Linux and Golang : Fix bind: address already in use error
+5.2k Golang : PGX CopyFrom to insert rows into Postgres database
+6.8k Get Facebook friends working in same company
+20.2k Golang : Convert seconds to human readable time format example
+26.8k Golang : Convert file content into array of bytes