4 ms·
While I don't like Go very much, but I find this one unjustified: > Similarly, the len function on strings returns the number of bytes in the string, which is
by ernst_klim 7y ago
While I don't like Go very much, but I find this one unjustified:
> Similarly, the len function on strings returns the number of bytes in the string, which is not necessarily the number of characters.
Should len do unicode normalization (NFC)? Than it's extremely complex. Or should it count code points? Then it's simply broken.
Counting bytes is fine, I'll do explicit normalization if I need to.
>can be conveniently concatenated with +, and can be used as map keys.
Does Go do a normalization for a concatenated string as it should?
- biztos 7y agoI believe it does: https://play.golang.org/p/oU9Q1GF6kr- https://play.golang.org/p/oU9Q1GF6kr-