Count occurrences of a substring: Difference between revisions
Content deleted Content added
/* {{header|Go}} |
|||
Line 101:
<pre>3
2</pre>
=={{header|Go}}==
Using strings.Count() method:<lang Go>package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Count("the three truths", "th")) // says: 3
fmt.Println(strings.Count("ababababab", "abab")) // says: 2
}</lang>
=={{header|Icon}} and {{header|Unicon}}==
|