strings.Count
Returns the number of non-overlapping instances of the given substring within the given string.
Syntax
strings.Count SUBSTR STRING
Returns
int
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
Last updated:
December 4, 2023
:
Squashed 'docs/' changes from 4d936aee6..4dd2d6415 (35dec7c96)
Improve this page