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
+9.6k Golang : How to extract video or image files from html source code
+11.8k Golang : Verify Linux user password again before executing a program example
+20.2k Golang : Convert seconds to human readable time format example
+7.5k Golang : How to stop user from directly running an executable file?
+14.7k Golang : Reset buffer example
+5.9k Golang : Detect variable or constant type
+4.6k Linux : sudo yum updates not working
+5.1k Linux : How to set root password in Linux Mint
+14.3k Golang : Get uploaded file name or access uploaded files
+10.4k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+9.7k Golang : interface - when and where to use examples