unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

ucd/case_mapping.mbt
1///|2/// Get the simple uppercase mapping for a character3/// Returns the character itself if no mapping exists4pub fn to_simple_uppercase(c : Char) -> Char {5  @case_mapping.lookup_simple_uppercase(c)6}78///|9/// Get the simple lowercase mapping for a character10/// Returns the character itself if no mapping exists11pub fn to_simple_lowercase(c : Char) -> Char {12  @case_mapping.lookup_simple_lowercase(c)13}1415///|16/// Get the simple titlecase mapping for a character17/// Returns the character itself if no mapping exists18pub fn to_simple_titlecase(c : Char) -> Char {19  @case_mapping.lookup_simple_titlecase(c)20}2122///|23/// Get the full uppercase mapping for a character24/// Returns a String containing one or more uppercase characters25/// For example, 'ß' (U+00DF) maps to "SS", and 'ffi' (U+FB03) maps to "FFI"26pub fn to_uppercase(c : Char) -> String {27  @case_mapping.full_uppercase(c)28}2930///|31/// Get the full lowercase mapping for a character32/// Returns a String containing one or more lowercase characters33/// For example, 'İ' (U+0130) maps to "i\u{0307}" (i with combining dot above)34pub fn to_lowercase(c : Char) -> String {35  @case_mapping.full_lowercase(c)36}3738///|39/// Get the full titlecase mapping for a character40/// Returns a String containing one or more titlecase characters41/// For example, 'ß' (U+00DF) maps to "Ss", and 'ffi' (U+FB03) maps to "Ffi"42pub fn to_titlecase(c : Char) -> String {43  @case_mapping.full_titlecase(c)44}4546///|47/// Get the full uppercase mapping of a string, with every character replaced48/// by its full uppercase mapping. For example, "Straße" maps to "STRASSE".49/// Unlike calling `to_uppercase` on each character, this builds one string50/// and allocates nothing per character.51///52/// The mapping is context-free: the conditional mappings of53/// SpecialCasing.txt, which depend on the surrounding text or the language,54/// are not applied. Unpaired surrogates are copied as they are.55pub fn uppercase(s : StringView) -> String {56  @case_mapping.uppercase(s)57}5859///|60/// Convert a string to lowercase using Unicode default full case conversion.61/// For example, "İSTANBUL" maps to "i\u{0307}stanbul". The Final_Sigma62/// condition is evaluated in the input: "ΟΣ" maps to "ος", while "ΟΣΑ"63/// maps to "οσα". Calling `to_lowercase` on individual characters cannot64/// apply this context-dependent mapping.65///66/// Language-specific mappings are not applied. Unpaired surrogates are67/// copied as they are.68pub fn lowercase(s : StringView) -> String {69  @case_mapping.lowercase(s)70}71