Search⌘ K
AI Features

Puzzle 15 Explanation: Length of Each Variable

Explore how Go's UTF-8 string encoding affects variable lengths and string comparison. Understand the differences between Normalization Forms NFC and NFD, and learn to use external libraries like golang.org/x/text/norm to normalize strings for accurate comparisons.

We'll cover the following...

Try it yourself

Try executing the code below to see the result.

Go (1.16.5)
package main
import (
"fmt"
)
func main() {
city1, city2 := "Krakow", "Kraków"
fmt.Println(city1 == city2)
}

Explanation

In the code above, do the two strings look similar? Yes. However, if ...