Deviopath › Go

Count Characters

Easy · Strings

len(s) is the number of bytes, not characters. "на" is 4 bytes and 2 runes. utf8.RuneCountInString(s) (or len([]rune(s))) counts characters.

Write RuneCount(s) that returns the number of Unicode characters in s.

Next: Absolute Value