Go count occurrences of a substring code example
Example: Go count occurrences of a substring
package main
import "fmt"
import "strings"
func main() {
fmt.Printf("%d\n", strings.Count("sea shells sea shells on the sea shore", "sea")) // 3
}
package main
import "fmt"
import "strings"
func main() {
fmt.Printf("%d\n", strings.Count("sea shells sea shells on the sea shore", "sea")) // 3
}