mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			668 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			668 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: countrunes
 | 
						|
description: Determines the number of runes in a string excluding any whitespace.
 | 
						|
categories: [functions]
 | 
						|
menu:
 | 
						|
  docs:
 | 
						|
    parent: functions
 | 
						|
keywords: [counting, word count]
 | 
						|
signature:
 | 
						|
  - "countrunes INPUT"
 | 
						|
  - "strings.CountRunes INPUT"
 | 
						|
relatedfuncs: []
 | 
						|
---
 | 
						|
 | 
						|
In contrast with `countwords` function, which counts every word in a string, the `countrunes` function determines the number of runes in the content and excludes any whitespace. This has specific utility if you are dealing with CJK-like languages.
 | 
						|
 | 
						|
```go-html-template
 | 
						|
{{ "Hello, 世界" | countrunes }}
 | 
						|
<!-- outputs a content length of 8 runes. -->
 | 
						|
```
 | 
						|
 | 
						|
[pagevars]: /variables/page/
 |