UnicodeData
Provides access to Unicode character properties and the global data provider.
Remarks
Provider property gives access to the full Unicode property database for script, line break, and grapheme cluster information.Removes every mandatory break character (the IsMandatoryBreakChar set) from the string, returning the same instance when there is nothing to strip.
public static bool IsCrlfAt(ReadOnlySpan<char> text, int index)Whether index holds the carriage return of a CRLF pair — the sequence UAX #14 LB5 and UAX #29 GB3 refuse to break, and which every line-ending rule counts as one terminator rather than two.
public static bool IsCrlfAt(ReadOnlySpan<int> codepoints, int index)Whether index holds the carriage return of a CRLF pair — the sequence UAX #14 LB5 and UAX #29 GB3 refuse to break, and which every line-ending rule counts as one terminator rather than two.
public static int NormalizeNewlines(ReadOnlySpan<char> source, Span<char> destination)Copies source into destination with every CRLF pair and every lone carriage return rewritten as a single line feed, returning the number of chars written. destination must be at least as long as source.
Returns the simple uppercase mapping for a codepoint, falling back to the codepoint itself when no mapping is defined. Backed by UnicodeData.txt so behavior is identical across Mono/IL2CPP/standard.NET — unlike char.ToUpperInvariant, which has gaps for codepoints such as Greek final sigma U+03C2.
Returns the simple lowercase mapping for a codepoint, falling back to the codepoint itself when no mapping is defined. See GetSimpleUppercase for the rationale.
public static GeneralCategory GetGeneralCategory(int codepoint)Returns the Unicode General Category of a codepoint. Useful for filtering codepoints in custom modifiers — apply only to letters (Lu/Ll/Lt/Lm/Lo), skip combining marks (Mn/Mc/Me), select punctuation (Pc/Pd/Ps/Pe/Pi/Pf/Po), and so on.
public static UnicodeScript GetScript(int codepoint)Returns the Unicode Script of a codepoint (UAX #24). Useful for script-conditional modifiers — for example applying a stylistic effect only to Devanagari or only to Han. Values UnicodeScript.Common and UnicodeScript.Inherited are shared across scripts (punctuation, combining marks).
public static uint DecodeAt(ReadOnlySpan<char> text, int index, out int size)Decodes one Unicode scalar and reports the consumed UTF-16 code units; an unpaired surrogate becomes ReplacementCharacter and consumes one unit.
public static int SizeAt(ReadOnlySpan<char> text, int index)Returns the number of UTF-16 code units occupied at index: two for a valid surrogate pair, otherwise one.
public static void MapCharsToCodepoints(ReadOnlySpan<char> text, ReadOnlySpan<int> charIndices, Span<int> codepoints)Maps ascending UTF-16 char indices to codepoint indices in one text walk. Indices may repeat; out-of-range input clamps to the end. Output may alias the input span.
public static void MapCodepointsToChars(ReadOnlySpan<char> text, ReadOnlySpan<int> codepoints, Span<int> charIndices)Maps ascending codepoint indices to UTF-16 char indices in one text walk. Indices may repeat; past-the-end input clamps to text.Length. Output may alias the input span.
public static int EncodeUtf16(int codepoint, Span<char> dst, int at)Encodes a Unicode scalar as UTF-16 into dst starting at at: one char for BMP codepoints, a surrogate pair otherwise. Returns the number of chars written (1 or 2).
String form of ObjectReplacementCharacter for insertion APIs.
