summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/strings/CountRunes.md
blob: 8ad6b00da627ad8a4578a7efc7ae7b4f57c96b16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
title: strings.CountRunes
description: Returns the number of runes in the given string excluding whitespace.
categories: []
keywords: []
params:
  functions_and_methods:
    aliases: [countrunes]
    returnType: int
    signatures: [strings.CountRunes INPUT]
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/