diff options
Diffstat (limited to 'docs/content/en/functions/strings/CountRunes.md')
-rw-r--r-- | docs/content/en/functions/strings/CountRunes.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/content/en/functions/strings/CountRunes.md b/docs/content/en/functions/strings/CountRunes.md new file mode 100644 index 000000000..4a17d04ab --- /dev/null +++ b/docs/content/en/functions/strings/CountRunes.md @@ -0,0 +1,29 @@ +--- +title: strings.CountRunes +linkTitle: countrunes +description: Returns the number of runes in a string excluding whitespace. +categories: [functions] +keywords: [] +menu: + docs: + parent: functions +function: + aliases: [countrunes] + returnType: int + signatures: [strings.CountRunes INPUT] +relatedFunctions: + - len + - strings.Count + - strings.CountRunes + - strings.CountWords + - strings.RuneCount +aliases: [/functions/countrunes] +--- + +In contrast with the [`strings.RuneCount`] function, which counts every rune in a string, `strings.CountRunes` excludes whitespace. + +```go-html-template +{{ "Hello, 世界" | strings.CountRunes }} → 8 +``` + +[`strings.RuneCount`]: /functions/strings/runecount |