Go语言计算指定字符串在另一个字符串中出现的次数
s := "Count, the number,, of commas."
n := 0
for _, c := range s {
if c == ',' {
n++
}
}
fmt.Println(n)
Go语言计算指定字符串在另一个字符串中出现的次数
s := "Count, the number,, of commas."
n := 0
for _, c := range s {
if c == ',' {
n++
}
}
fmt.Println(n)