3 ms·
Character indexing in UTF-8 is O(n). That's not enough to kill the awesome parts of it, though.
by qwertyuiop924 10y ago
Character indexing in UTF-8 is O(n). That's not enough to kill the awesome parts of it, though.
- nickpsecurity 10y agoIs there a list of alternatives with various tradfoffs mentioned?
- qwertyuiop924 10y agoUTF-32 is kinda-sorta O(1), but not really if you want to get what a user logically claims to a character.
- slededit 10y agoIt is for all but UTF-32. And even in the case of UTF-32 if you are indexing for what a user would logically consider a character then its O(n) there is well because of combining characters.