|
|
|
|
|
by eis
2233 days ago
|
|
Yep. Here a Go playground example showing that the result is indeed wrong: https://play.golang.org/p/vmctMFUevPc It should output 3 but outputs 5 because each ö is two bytes, len("föö") = 5. I would suggest using "range" to iterate over the unicode characters. |
|
The code is weird because someone knew enough to convert the strings to slices of runes but not enough to use the rune slices consistently. :-/