fmt.Sscanf
is the reverse of fmt.Sprintf
. Given a string and formatting directive you can parse string into components.
https://codeeval.dev/gist/120dabfc7c05db13e311c8c57dc2fb12
fmt.Sscanf
supports the same formatting directives as fmt.Sprintf
.
If formatting string doesn't match parsed string, fmt.Sscanf
returns an error. In our examples the error is EOF
because we wanted to extract more values than were in the string.
string.Split
allows to split a string by a separator.