Re:Zig 0.9.0
by noisem4ker on Tuesday December 21, 2021 @02:26PM
(#29641059)
Go presents strings as slices of bytes (chars). As long as it's ASCII, it's fine. However, when dealing with multi-byte UTF-8 characters (codepoints), the proper unit is the rune. So, before attempting to measure a string's length, or read its n-th character, one must remember and access the string as a slice of runes.
https://go.dev/play/p/YbMo49wU7vu
[ Parent
| on HN ]