Created
May 10, 2019 22:52
-
-
Save arxdsilva/6f9dc414814f08aca47e3221d3ca7fa3 to your computer and use it in GitHub Desktop.
utf8 rune count in string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "unicode/utf8" | |
func main() { | |
fmt.Println("Hello, 世界", len("世界"), utf8.RuneCountInString("世界")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment