package main import ( "fmt" "strings" ) func main() { s := "foo bar baz" for i, part := range strings.SplitN(s, " ", 1) { fmt.Println(i, part) } }
To embed this program on your website, copy the following code and paste it into your website's HTML: