Golang strings パッケージ
スペース区切りの文字列を配列に変換
someString := "one two three four " words := strings.Fields(someString) fmt.Println(words, len(words)) // [one two three four] 4
スペース区切りの文字列を配列に変換
someString := "one two three four "
words := strings.Fields(someString)
fmt.Println(words, len(words)) // [one two three four] 4