2 ms·
No, that's not how it works - indexing a string returns a byte, and strings have len() their bytes in UTF8. Ranging a string does return unicode runes, however
by mappu 9y ago
No, that's not how it works - indexing a string returns a byte, and strings have len() their bytes in UTF8.
Ranging a string does return unicode runes, however, but ranging is obviously O(n) anyway.
https://play.golang.org/p/oyaChPTb576 https://play.golang.org/p/oyaChPTb576