strings.RuneCount
Returns the number of runes in the given string, including whitespace and HTML tags.
- Syntax
- strings.RuneCount STRING
- Returns
- int
Usage
The strings.RuneCount function returns the number of runes in the given string, including whitespace and HTML tags. In contrast, the strings.CountRunes function excludes whitespace and HTML tags.
Examples
{{ "Hugo is a static site generator." | strings.RuneCount }} → 32Counting runes in a string that contains HTML tags:
{{ "<p>Hugo is a <em>static</em> site generator.</p>" | strings.RuneCount }} → 48Counting runes in a string that contains Chinese characters:
{{ "Hugo 是一个静态网站生成器" | strings.RuneCount }} → 15Last updated:
November 8, 2026
:
content: Remove categories from front matter (1cc1dd83a)
Improve this page