Sign in

    unicode

    Unicode in MoonBit

    unicode
    bidi
    idna
    nfc
    nfd
    nfkc
    nfkd
    punycode
    Download zip
    Version
    0.6.0
    License
    Apache-2.0
    Last updated
    9 days ago
    Downloads
    16K

    #unicode

    moonbit-community/unicode is the compatibility umbrella for the Unicode library that is split into independently consumable modules. It preserves the original package paths for existing users by forwarding to the feature modules.

    The generated tables target Unicode 18.0.0.

    #Packages

    PackageContents
    moonbit-community/unicodeGeneral_Category, binary properties (White_Space, Alphabetic, Lowercase, Uppercase, XID_Start, XID_Continue), and case mapping
    moonbit-community/unicode/normalizationNormalization Forms from UAX #15
    moonbit-community/unicode/punycodePunycode from RFC 3492
    moonbit-community/unicode/bidiBidirectional algorithm from UAX #9
    moonbit-community/unicode/idnaIDNA processing from UTS #46

    New code should depend on the feature module it needs directly:

    moon add moonbit-community/unicode-data moon add moonbit-community/unicode-normalization moon add moonbit-community/punycode moon add moonbit-community/unicode-bidi moon add moonbit-community/unicode-idna

    See the repository README for the full API reference, development commands, and release instructions.

    EastAsianWidth

    Unicode East_Asian_Width values See UAX #11: https://www.unicode.org/reports/tr11/

    GeneralCategory

    pub(all) enum GeneralCategory {
    Lu
    Ll
    Lt
    Lm
    Lo
    Mn
    Mc
    Me
    Nd
    Nl
    No
    Zs
    Zl
    Zp
    Pc
    Pd
    Ps
    Pe
    Pi
    Pf
    Po
    Sm
    Sc
    Sk
    So
    Cc
    Cf
    Cs
    Co
    Cn
    } derive(Eq)

    GeneralCategory::equal

    GeneralCategory::group

    GeneralCategory::not_equal

    fn GeneralCategory::not_equal(x : GeneralCategory, y : GeneralCategory) -> Bool

    GeneralCategory::output

    fn GeneralCategory::output(self : GeneralCategory, logger : &Logger) -> Unit

    GeneralCategory::to_string

    fn GeneralCategory::to_string(self : GeneralCategory) -> String

    GeneralCategoryGroup

    pub(all) enum GeneralCategoryGroup {
    L
    M
    N
    Z
    P
    S
    C
    } derive(Eq,
    Debug
    )

    GeneralCategoryGroup::equal

    GeneralCategoryGroup::not_equal

    GeneralCategoryGroup::output

    fn GeneralCategoryGroup::output(self : GeneralCategoryGroup, logger : &Logger) -> Unit

    GeneralCategoryGroup::to_string

    fn GeneralCategoryGroup::to_string(self : GeneralCategoryGroup) -> String

    east_asian_width

    Get the East_Asian_Width for a character.

    East_Asian_Width classifies characters by the width they have in East Asian typography. It is a property of a single character, not a column count: nonspacing marks and control characters have a value too. Code points the Unicode Character Database does not list are Neutral, except that unassigned code points in the CJK ideograph blocks and in planes 2 and 3 are Wide.

    general_category

    fn general_category(c : Char) -> GeneralCategory

    is_alphabetic

    fn is_alphabetic(c : Char) -> Bool

    Check whether a character has the Unicode Alphabetic property.

    Alphabetic covers the letters (General_Category L), letter numbers (Nl), and Other_Alphabetic characters such as the vowel signs of Indic scripts. Decimal digits are not Alphabetic.

    is_lowercase

    fn is_lowercase(c : Char) -> Bool

    Check whether a character has the Unicode Lowercase property.

    Lowercase is broader than General_Category Ll: it also covers Other_Lowercase characters such as U+00AA FEMININE ORDINAL INDICATOR, modifier letters like U+02B0, and the small Roman numerals. Titlecase letters (Lt) are neither Lowercase nor Uppercase.

    is_uppercase

    fn is_uppercase(c : Char) -> Bool

    Check whether a character has the Unicode Uppercase property.

    Uppercase is broader than General_Category Lu: it also covers Other_Uppercase characters such as the capital Roman numerals and the circled capital Latin letters. Titlecase letters (Lt) are neither Lowercase nor Uppercase.

    is_white_space

    fn is_white_space(c : Char) -> Bool

    Check whether a character has the Unicode White_Space property.

    White_Space covers the ASCII controls TAB, LF, VT, FF, and CR, the space separators (General_Category Zs), U+0085 NEXT LINE, and the line and paragraph separators U+2028 and U+2029. It does not include U+200B ZERO WIDTH SPACE or U+FEFF ZERO WIDTH NO-BREAK SPACE.

    is_xid_continue

    fn is_xid_continue(c : Char) -> Bool

    Check whether a character has the Unicode XID_Continue property.

    XID_Continue is the recommended continuation class for Unicode default identifiers and includes every XID_Start character.

    is_xid_start

    fn is_xid_start(c : Char) -> Bool

    Check whether a character has the Unicode XID_Start property.

    XID_Start is the recommended start class for Unicode default identifiers.

    to_lowercase

    fn to_lowercase(c : Char) -> String

    Get the full lowercase mapping for a character Returns a String containing one or more lowercase characters For example, 'İ' (U+0130) maps to "i\u{0307}" (i with combining dot above)

    to_simple_lowercase

    fn to_simple_lowercase(c : Char) -> Char

    Get the simple lowercase mapping for a character Returns the character itself if no mapping exists

    to_simple_titlecase

    fn to_simple_titlecase(c : Char) -> Char

    Get the simple titlecase mapping for a character Returns the character itself if no mapping exists

    to_simple_uppercase

    fn to_simple_uppercase(c : Char) -> Char

    Get the simple uppercase mapping for a character Returns the character itself if no mapping exists

    to_titlecase

    fn to_titlecase(c : Char) -> String

    Get the full titlecase mapping for a character Returns a String containing one or more titlecase characters For example, 'ß' (U+00DF) maps to "Ss", and 'ffi' (U+FB03) maps to "Ffi"

    to_uppercase

    fn to_uppercase(c : Char) -> String

    Get the full uppercase mapping for a character Returns a String containing one or more uppercase characters For example, 'ß' (U+00DF) maps to "SS", and 'ffi' (U+FB03) maps to "FFI"

    Source Files