hugo/content/en/functions/strings.Count.md
Bjørn Erik Pedersen 534ae9c57a Squashed 'docs/' changes from d3eb97a33..4895c29c5
4895c29c5 Document strings.Count function

git-subtree-dir: docs
git-subtree-split: 4895c29c5b1e090eea69dc6223b2e20e3b934a6f
2020-09-13 21:58:53 +02:00

735 B

title description godocref date publishdate lastmod categories menu keywords signature workson hugoversion relatedfuncs deprecated aliases
strings.Count Returns the number of non-overlapping instances of a substring within a string. 2020-09-07 2020-09-07 2020-09-07
functions
docs
parent
functions
count
counting
character count
strings.Count SUBSTR STRING
false

{{< new-in "0.74.0" >}}

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

Example Result
`{{ "aaabaab" strings.Count "a" }}`
`{{ "aaabaab" strings.Count "aa" }}`
`{{ "aaabaab" strings.Count "aaa" }}`
`{{ "aaabaab" strings.Count "" }}`