3 ms·
To clarify even more: that length is the number of bytes (or UTF-8 code units) in the string. It doesn't corresponding to the number of characters (which one ma
by burntsushi 10y ago
To clarify even more: that length is the number of bytes (or UTF-8 code units) in the string. It doesn't corresponding to the number of characters (which one may either consider to be Unicode codepoints, or more technically correct, Unicode grapheme clusters).
If you want to count the number of codepoints in a string (called "rune" in Go), then you need to do so explicitly: https://golang.org/pkg/unicode/utf8/#RuneCountInString https://golang.org/pkg/unicode/utf8/#RuneCountInString
- weberc2 10y agoTouché
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]