Hacker News new | past | comments | ask | show | jobs | submit login

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




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: