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:
October 28, 2026
:
content: Apply style guide to strings functions (d6de31ebd)
Improve this page