miniBill / elm-unicode / Unicode

Unicode aware functions for working with characters.

Letters

isUpper : Char -> Basics.Bool

Detect upper case characters (Unicode category Lu)

isLower : Char -> Basics.Bool

Detect lower case characters (Unicode category Ll)

isAlpha : Char -> Basics.Bool

Detect letters (Unicode categories Lu, Ll, Lt, Lm, Lo)

isAlphaNum : Char -> Basics.Bool

Detect letters or digits (Unicode categories Lu, Ll, Lt, Lm, Lo, Nd, Nl, No)

Digits

isDigit : Char -> Basics.Bool

Detect digits (Unicode categories Nd, Nl, No)

Categories


type Category
    = LetterUppercase
    | LetterLowercase
    | LetterTitlecase
    | MarkNonSpacing
    | MarkSpacingCombining
    | MarkEnclosing
    | NumberDecimalDigit
    | NumberLetter
    | NumberOther
    | SeparatorSpace
    | SeparatorLine
    | SeparatorParagraph
    | OtherControl
    | OtherFormat
    | OtherSurrogate
    | OtherPrivateUse
    | OtherNotAssigned
    | LetterModifier
    | LetterOther
    | PunctuationConnector
    | PunctuationDash
    | PunctuationOpen
    | PunctuationClose
    | PunctuationInitialQuote
    | PunctuationFinalQuote
    | PunctuationOther
    | SymbolMath
    | SymbolCurrency
    | SymbolModifier
    | SymbolOther

A category as defined by the Unicode standard.

getCategory : Char -> Maybe Category

Get the Unicode category. Warning: this function is very big. You should usually use one of the isXXX ones instead.

categoryFromString : String -> Maybe Category

Parses a category name (Lu, Ll, Lt, ...).

categoryToString : Category -> String

Convert a category to its short category name (Lu, Ll, Lt, ...).

categoryToDescription : Category -> String

Converts a category to its English description. Mostly useful for debugging purposes.

Separators

isSpace : Char -> Basics.Bool

Detect spaces (Unicode category Zs)

isSeparator : Char -> Basics.Bool

Detect spaces (Unicode categories Zs, Zl, Zp)