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
+6.1k Golang : Scan forex opportunities by Bollinger bands
+5.9k Unix/Linux : How to open tar.gz file ?
+12.7k Android Studio : Highlight ImageButton when pressed on example
+8k Findstr command the Grep equivalent for Windows
+15.4k Golang : Find location by IP address and display with Google Map
+9.7k PHP : Get coordinates latitude/longitude from string
+16.3k Golang : How to extract links from web page ?
+8.2k Golang : Get final or effective URL with Request.URL example
+29.1k Golang : Get first few and last few characters from string
+27.6k PHP : Convert(cast) string to bigInt
+4.8k PHP : Extract part of a string starting from the middle
+10.1k Golang : Test a slice of integers for odd and even numbers