You must log in or register to comment.
This is potentially dangerous, as it encourages dealing with text as an array of
char
s. But graphemes in Unicode, which represent a single symbol in a writing system (such as “H”, “心”, or “💚”), can take up multiplechar
s in a string. The linked approaches only work if you can guarantee that your string only contains ASCII. See also: The Absolute Minimum Every Software Developer Must Know About Unicode in 2023 (Still No Excuses!)Yes, good point - I’d forgotten about Unicode in this context.