| 1 |
--- |
| 2 |
title: strings.CountRunes |
| 3 |
description: Returns the number of runes in the given string excluding whitespace. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [countrunes] |
| 9 |
returnType: int |
| 10 |
signatures: [strings.CountRunes STRING] |
| 11 |
aliases: [/functions/countrunes] |
| 12 |
--- |
| 13 |
|
| 14 |
In contrast with the [`strings.RuneCount`][] function, which counts every rune in a string, `strings.CountRunes` excludes whitespace. |
| 15 |
|
| 16 |
```go-html-template |
| 17 |
{{ "Hello, 世界" | strings.CountRunes }} → 8 |
| 18 |
``` |
| 19 |
|
| 20 |
[`strings.RuneCount`]: /functions/strings/runecount/ |