Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDavid E. Wheeler <david@justatheory.com>2018-06-04 20:47:03 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-06-04 20:47:03 +0300
commit019bd5576be87c9f06b6a928ede1a5e78677f7b3 (patch)
tree2eba3a897b200a127ccd5e2e952551e03a9c5c89 /docs
parentc3115292a7f2d2623cb45054a361e997ad9330c9 (diff)
tpl/strings: strings.RuneCount
Diffstat (limited to 'docs')
-rw-r--r--docs/content/en/functions/strings.RuneCount.md28
-rw-r--r--docs/data/docs.json20
2 files changed, 47 insertions, 1 deletions
diff --git a/docs/content/en/functions/strings.RuneCount.md b/docs/content/en/functions/strings.RuneCount.md
new file mode 100644
index 000000000..63012ab39
--- /dev/null
+++ b/docs/content/en/functions/strings.RuneCount.md
@@ -0,0 +1,28 @@
+---
+title: strings.RuneCount
+description: Determines the number of runes in a string.
+godocref:
+date: 2018-06-01
+publishdate: 2018-06-01
+lastmod: 2018-06-01
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [counting, character count, length, rune length, rune count]
+signature: ["strings.RuneCount INPUT"]
+workson: []
+hugoversion:
+relatedfuncs: ["len", "countrunes"]
+deprecated: false
+aliases: []
+---
+
+In contrast with `strings.CountRunes` function, which strips HTML and whitespace before counting runes, `strings.RuneCount` simply counts all the runes in a string. It relies on the Go [`utf8.RuneCountInString`] function.
+
+```
+{{ "Hello, 世界" | strings.RuneCount }}
+<!-- outputs a content length of 9 runes. -->
+```
+
+[`utf8.RuneCount`]: https://golang.org/pkg/unicode/utf8/#RuneCount \ No newline at end of file
diff --git a/docs/data/docs.json b/docs/data/docs.json
index 4eddf8eae..3020a21f2 100644
--- a/docs/data/docs.json
+++ b/docs/data/docs.json
@@ -3146,7 +3146,25 @@
"Aliases": [
"countrunes"
],
- "Examples": []
+ "Examples": [
+ [
+ "{{ \"Hello, 世界\" | countrunes }}",
+ "8"
+ ]
+ ]
+ },
+ "RuneCount": {
+ "Description": "RuneCount returns the number of runes in s",
+ "Args": [
+ "s"
+ ],
+ "Aliases": [],
+ "Examples": [
+ [
+ "{{ \"Hello, 世界\" | strings.RuneCount }}",
+ "9"
+ ]
+ ]
},
"CountWords": {
"Description": "CountWords returns the approximate word count in s.",