import ( "fmt" "strings")func main() { //检查字符串传是否包含指定字符,返回true或者false fmt.Println(strings.Contains("hello go", "hello")) //组合切片成一个字符串 fmt.Println(strings.Join([]string{"a", "1"}, ",")) //查找字符串返回索引 fmt.Println(strings.Index("hello go", "go")) //追加字符串 fmt.Println(strings.Repeat("go", 3)) //拆分字符串为切片 fmt.Println(strings.Split("222,33", ",")) //去掉头尾指定字符 fmt.Println(strings.Trim("a w w w a a", "a")) //去掉首位空格放入切片 fmt.Println(strings.Fields("w 1 2 3 "))}