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
+12.3k Golang : Validate email address
+6.1k Golang : Grab news article text and use NLP to get each paragraph's sentences
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+32.7k Golang : Regular Expression for alphanumeric and underscore
+13.9k Golang : How to check if a file is hidden?
+9.4k Golang : Launch Mac OS X Preview (or other OS) application from your program example
+20.9k PHP : Convert(cast) int to double/float
+23.5k Golang : Read a file into an array or slice example
+5.7k Fix yum-complete-transaction error
+12.1k Golang : convert(cast) string to integer value
+9.6k Golang : How to generate Code 39 barcode?
+36.5k Golang : Save image to PNG, JPEG or GIF format.