hugo/docs/content/en/functions/strings/Count.md
Bjørn Erik Pedersen 5fd1e74903
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
```
git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash
```

Closes #11925
2024-01-27 10:48:57 +01:00

737 B

title description categories keywords action aliases
strings.Count Returns the number of non-overlapping instances of the given substring within the given string.
aliases related returnType signatures
functions/go-template/len
functions/strings/CountRunes
functions/strings/CountWords
functions/strings/RuneCount
int
strings.Count SUBSTR STRING
/functions/strings.count

If SUBSTR is an empty string, this function returns 1 plus the number of Unicode code points in STRING.

{{ "aaabaab" | strings.Count "a" }} → 5
{{ "aaabaab" | strings.Count "aa" }} → 2
{{ "aaabaab" | strings.Count "aaa" }} → 1
{{ "aaabaab" | strings.Count "" }} → 8