package main import ( "fmt" "strings" ) func main() { s2 := "abc21313abc3456abc3131zhengyuabc" m := strings.Count(s2, "1") fmt.Printf("1的出现次数是%d\n",m) fmt.Println(strings.Index(s2,"1")) fmt.Println(strings.EqualFold("HeLLo", "hello")) fmt.Println("HeLLo" == "hello") }
#统计字符串abc出现的次数
strings.Count("abc1234qwerabc", "abc")
#忽略大小写判断两个字符串是否相等
strings.EqualFold("HeLLo", "hello")
#判断两个字符串是否绝对相等
fmt.Println("HeLLo" == "hello")