Back to API Reference
Enum
TextLengthUnit
How text length is measured. The user-facing default is Graphemes — what a person counts as one character (a family emoji, an accented letter) — unlike codepoints or UTF-16 units, which can be higher than expected.
public static readonly TextLengthUnit Graphemes = 0User-perceived characters (UAX #29 grapheme clusters). A ZWJ emoji or base + combining mark counts as one.
public static readonly TextLengthUnit Utf16Units = 1UTF-16 code units — matches string.Length in C#/JS/Java, for parity with such a backend.
public static readonly TextLengthUnit Utf8Bytes = 2UTF-8 bytes — for a field backed by a byte-sized DB column or wire field.
public static readonly TextLengthUnit Codepoints = 3Unicode codepoints (scalar values). Surrogate-safe, but still splits emoji/ZWJ sequences.
