UnicodeCaseMapping Class

Converts a text to uppercase or to lowercase, with the case mappings that depend on the context and on the language.

public static class UnicodeCaseMapping

Remarks

The conversions are the full case conversions of the Unicode Standard (section 3.13, toUppercase and toLowercase) for UnicodeProperties.UnicodeVersion: the mappings of SpecialCasing.txt, else the simple mappings of UnicodeData.txt, a code point being able to map to several ones. The conditional mappings of SpecialCasing.txt are applied:

  • In every language, a capital sigma (U+03A3) lowercases to the final sigma (U+03C2) at the end of a word, when it is preceded by a cased letter and not followed by one, ignoring the case-ignorable characters between them (Final_Sigma); else to the small sigma (U+03C3). A character that is both cased and case-ignorable, such as the modifier letter U+02B0, is ignored, as ICU does.
  • In Turkish and Azerbaijani (tr, az), I lowercases to the dotless i (U+0131), the dotted capital I (U+0130) to i, and I followed by a combining dot above (U+0307) to i; i uppercases to the dotted capital I (U+0130).
  • In Lithuanian (lt), the lowercase i keeps its dot under an accent: I, J and the I with ogonek (U+012E) followed by an accent above lowercase with a combining dot above (U+0307), and the I with grave, acute or tilde (U+00CC, U+00CD, U+0128) to i, a dot above and the accent. Uppercasing removes the combining dot above that follows a soft-dotted letter such as i or j, with no character of combining class 0 or 230 between them.

The other languages have no tailoring in SpecialCasing.txt: the mappings of the Common Locale Data Repository, such as the removal of the Greek accents when uppercasing, are not applied.

The conversions do not use the globalization library of the platform: the results are the same on every platform and every framework version, including in globalization-invariant mode. An unpaired surrogate is copied as is.

See also

Methods

NameDescription
ToLower(string, string?)Converts a text to lowercase.
ToUpper(string, string?)Converts a text to uppercase.

ToLower(string, string?)

UnicodeCaseMapping.cs

Converts a text to lowercase.

public static string ToLower(string value, string? language = null)

Parameters

value string
The text.
language string?
The language of the text, as a BCP 47 language tag such as tr or lt-LT, or null for the mappings that do not depend on the language. Only the language subtag is read, ignoring case: tr, az and lt (or tur, aze and lit) select their mappings, and every other language uses the mappings that do not depend on the language.

Returns

string The text in lowercase; value itself when no character changes.

Exceptions

ArgumentNullException
value is null.

ToUpper(string, string?)

UnicodeCaseMapping.cs

Converts a text to uppercase.

public static string ToUpper(string value, string? language = null)

Parameters

value string
The text.
language string?
The language of the text, as a BCP 47 language tag such as tr or lt-LT, or null for the mappings that do not depend on the language. Only the language subtag is read, ignoring case: tr, az and lt (or tur, aze and lit) select their mappings, and every other language uses the mappings that do not depend on the language.

Returns

string The text in uppercase; value itself when no character changes.

Exceptions

ArgumentNullException
value is null.