someString := "one two three four "
words := strings.Fields(someString)
fmt.Println(words, len(words)) // [one two three four] 4
golang 去除空格读取字符串单词
猜你喜欢
转载自blog.csdn.net/MR1269427885/article/details/53859824
今日推荐
周排行