Strings In Depth17 / 17
Up next

unicode/utf8

package main

import (
	"fmt"
	"unicode/utf8"
)

func main() {
	s := "héllo"
	// len is bytes; RuneCountInString is characters
	fmt.Println(len(s), utf8.RuneCountInString(s))
}
What you're solving

count runes vs bytes