-9
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 multiple char
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!)