codingdebuggingstrings
Why can a string's length surprise you?
Anonymous
A string length can count bytes, code points, or grapheme clusters depending on the API. Those are different units: a visible symbol may be represented by multiple code points, and a code point may use multiple bytes in UTF-8. Check which unit an operation uses before slicing or validating input.
0