3 ms·
Now you have two problems: managing utf-8 encoding (the idea that you won't want constant access into a string is pretty laughable—do you not ever use ranges?),
by duaneb 10y ago
Now you have two problems: managing utf-8 encoding (the idea that you won't want constant access into a string is pretty laughable—do you not ever use ranges?), and trying to work with a language that doesn't support unicode first class.
- pjscott 10y agoRandom access by code point is hardly ever quite what you want, and UTF-8 is not a bad internal encoding. http://dparrol.github.io/unicode-random-indexing.html http://dparrol.github.io/unicode-random-indexing.html
- continuational 10y agoOnce you have a range, access to either side of it is constant time. The only thing you can't do is to "skip ahead X codepoints" in constant time. And I can't think of a single use case for it.