GeneralCategory enumv0.1.0

Source
The Unicode general category, one per scalar value.
pub enum GeneralCategory: int32 {
    Unassigned = 0,
    UppercaseLetter = 1,
    LowercaseLetter = 2,
    TitlecaseLetter = 3,
    ModifierLetter = 4,
    OtherLetter = 5,
    NonspacingMark = 6,
    SpacingMark = 7,
    EnclosingMark = 8,
    DecimalNumber = 9,
    LetterNumber = 10,
    OtherNumber = 11,
    ConnectorPunctuation = 12,
    DashPunctuation = 13,
    OpenPunctuation = 14,
    ClosePunctuation = 15,
    InitialPunctuation = 16,
    FinalPunctuation = 17,
    OtherPunctuation = 18,
    MathSymbol = 19,
    CurrencySymbol = 20,
    ModifierSymbol = 21,
    OtherSymbol = 22,
    SpaceSeparator = 23,
    LineSeparator = 24,
    ParagraphSeparator = 25,
    Control = 26,
    Format = 27,
    Surrogate = 28,
    PrivateUse = 29
}

Copy. The ordinals match the generated table and must not be reordered: the table stores them as numbers.

Cases

NameValueDescription
Unassigned0Unassigned, or outside every range.
UppercaseLetter1Lu: an uppercase letter.
LowercaseLetter2Ll: a lowercase letter.
TitlecaseLetter3Lt: a titlecase letter.
ModifierLetter4Lm: a modifier letter.
OtherLetter5Lo: a letter without case.
NonspacingMark6Mn: a nonspacing mark.
SpacingMark7Mc: a spacing combining mark.
EnclosingMark8Me: an enclosing mark.
DecimalNumber9Nd: a decimal digit.
LetterNumber10Nl: a letterlike number.
OtherNumber11No: some other number.
ConnectorPunctuation12Pc: a connector.
DashPunctuation13Pd: a dash.
OpenPunctuation14Ps: an opening bracket.
ClosePunctuation15Pe: a closing bracket.
InitialPunctuation16Pi: an initial quote.
FinalPunctuation17Pf: a final quote.
OtherPunctuation18Po: other punctuation.
MathSymbol19Sm: a mathematical symbol.
CurrencySymbol20Sc: a currency symbol.
ModifierSymbol21Sk: a modifier symbol.
OtherSymbol22So: some other symbol.
SpaceSeparator23Zs: a space separator.
LineSeparator24Zl: the line separator.
ParagraphSeparator25Zp: the paragraph separator.
Control26Cc: a control character.
Format27Cf: an invisible formatting character.
Surrogate28Cs: a surrogate half, which no scalar value is.
PrivateUse29Co: private use.

CategoryOf

pub func CategoryOf(scalar: char32) -> GeneralCategory

The general category of scalar. Runs in a handful of comparisons and allocates nothing.

Source

Parameters

NameTypeDescription
scalarchar32the scalar value to classify

Returns: its general category