Re:How UTF-8 Works
by pjscott on Tuesday February 08, 2022 @03:18PM
(#30264016)
Also, if you want O(1) indexing by grapheme cluster you can get that with less memory overhead by precomputing a lookup table of the location in the string where you can find every k-th grapheme cluster, for some constant k >= 1. (This requires a single O(n) pass through the string to build the index, but you were always going to have do make at least one such pass through the string for other reasons.)
[ Parent
| on HN ]
There are no comments on this comment yet.