5 ms·
> There are two relevant lengths of Unicode strings: memory size in bytes and number of grapheme clusters. There is also the number of codepoints, which is rel
by perlgeek 8y ago
> There are two relevant lengths of Unicode strings: memory size in bytes and number of grapheme clusters.
There is also the number of codepoints, which is relevant when you implement Unicode-related algorithms.
And then there is display length (which counts full-width characters as two characters, even in monospace fonts, and zero-width characters as zero).
Finally, if you think grapheme clusters are the right way to count characters in a string (and it often is), then you should also allow string indexing on grapheme cluster level.