golang 按空格分割的字符串转slice
func TestStringSlice(t *testing.T) {
words := "test1 test2 test3"
ws := strings.Fields(words)
for index, wd := range ws {
fmt.Println("index", index)
fmt.Println("wd", wd)
}
}
func TestStringSlice(t *testing.T) {
words := "test1 test2 test3"
ws := strings.Fields(words)
for index, wd := range ws {
fmt.Println("index", index)
fmt.Println("wd", wd)
}
}