100 Mistakes in Golang: Chapter 5
36: Not understanding the concept of a rune The len built-in function applied on a string doesn’t return the number of characters; it returns the number of bytes. What if we want to get the number of runes in a string, not the number of bytes? How we can do this depends on the encoding. In the previous example, because we assigned a string literal to s, we can use the unicode/utf8 package: ...