diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-09-13 21:58:53 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-09-13 21:58:53 +0200 |
commit | df56682a105ec5452b8ab2efeb6058d4b83f764c (patch) | |
tree | 828e00a9f907ca7a2b74e89f79a8d0b735754371 /docs | |
parent | be2404c8b17d3275cc82d9e659b9e41dddea7ded (diff) | |
parent | 534ae9c57a902aea9ed6e62390dec11fa74b7122 (diff) |
Merge commit '534ae9c57a902aea9ed6e62390dec11fa74b7122'
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/en/functions/strings.Count.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/content/en/functions/strings.Count.md b/docs/content/en/functions/strings.Count.md new file mode 100644 index 000000000..3971c7da1 --- /dev/null +++ b/docs/content/en/functions/strings.Count.md @@ -0,0 +1,30 @@ +--- +title: strings.Count +description: Returns the number of non-overlapping instances of a substring within a string. +godocref: +date: 2020-09-07 +publishdate: 2020-09-07 +lastmod: 2020-09-07 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [count, counting, character count] +signature: ["strings.Count SUBSTR STRING"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +{{< 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" }}`|5 +`{{ "aaabaab" | strings.Count "aa" }}`|2 +`{{ "aaabaab" | strings.Count "aaa" }}`|1 +`{{ "aaabaab" | strings.Count "" }}`|8 |