4 ms·
In Go: func main() { shit := "\U0001f4a9" fmt.Printf("len of %s is %d\n", shit, utf8.RuneCountInString(shit)) } $ len of � is 1 Though I can'
by gtrubetskoy 10y ago
In Go:
func main() {
shit := "\U0001f4a9"
fmt.Printf("len of %s is %d\n", shit, utf8.RuneCountInString(shit))
}
$ len of � is 1
Though I can't say that this is all that intuitive either...
- geocar 10y agoCodepoints still aren't the same as characters. Consider the examples given about combining emoji; Consider two runes that make one character: e and ◌́