3 ms·
Go treats strings as a sequence of unicode code points.
by colin_mccabe 5y ago
Go treats strings as a sequence of unicode code points.
- fnoof 5y agoI believe they’re treated as byte sequences: https://go.dev/ref/spec#String_types https://go.dev/ref/spec#String_types
- ustolemyname 5y agoNot treated as, only backed by byte sequences. If you range over them you get a series of rune values that can be multi-byte code points. There's a few other differences, strings cannot be directly mutated or have the address of their elements taken.