Using fmt.Sscanf

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.

Using strings.Split

string.Split allows to split a string by a separator.

https://codeeval.dev/gist/f3936fb5aa807263b9b8b30b86e59a69