Best match for what users see as one character, including combined emoji and accents.
Counts Unicode scalar values. Emoji modifiers and combining marks may count separately.
JavaScript string length. Some emoji and rare characters count as two units.
Uses locale-aware word segmentation when supported instead of only splitting by spaces.
Counts how many bytes the text needs when encoded as UTF-8.
Counts text lines separated by line breaks.
Locale-aware counting
Word segmentation uses the current locale (en) when Intl.Segmenter is available, which is important for languages that do not always separate words with spaces.