Hacker News new | ask | show | jobs
by elcaro 980 days ago
Another Unicode article that mentions Swift, but not Raku :(

Raku's Str type has a `.chars` method that counts graphemes. It has a separate `.codes` method to count codepoints. It also can do O(1) string indexing at the grapheme level.

That Zalgo "word" example is counted as 4 chars, and the different comparisons of "Å" are all True in Raku.

You can argue about the merits of it's approach (indeed several commenters here disagree that graphemes are the "one true way" to count characters), but it feels lacking to not at least _mention_ Raku when talking about how different programming languages handle Unicode.