s := "Count, the number,, of commas." n := 0 for _, c := range s { if c == ',' { n++ } } fmt.Println(n)