Char
Core
Functions for working with characters. Character literals are enclosed in a pair of single quotes:
'a'
'0'
'Z'
'?'
'Σ'
'🙈'
'\t'
'\''
'\u{1F648}' -- '🙈'**Note:** You cannot use single quotes around multiple characters. That is how String and Char values are distinguished in syntax.
Values
isDigit
isDigit : Char -> BoolDetect digits 0123456789.
Examples
isDigit '0' == True
isDigit '9' == True
isDigit 'a' == False
isDigit 'A' == FalseisOctDigit
isOctDigit : Char -> BoolDetect octal digits 01234567.
Examples
isOctDigit '0' == True
isOctDigit '7' == True
isOctDigit '8' == False
isOctDigit 'a' == FalseisHexDigit
isHexDigit : Char -> BoolDetect hexadecimal digits 0123456789abcdefABCDEF.
Examples
isHexDigit 'a' == True
isHexDigit 'F' == True
isHexDigit 'g' == FalseisUpper
isUpper : Char -> BoolDetect upper case ASCII characters.
Examples
isUpper 'A' == True
isUpper 'Z' == True
isUpper '0' == False
isUpper 'a' == False
isUpper 'Σ' == FalseisLower
isLower : Char -> BoolDetect lower case ASCII characters.
Examples
isLower 'a' == True
isLower 'z' == True
isLower '0' == False
isLower 'A' == False
isLower 'π' == FalseisAlpha
isAlpha : Char -> BoolDetect upper case and lower case ASCII characters.
Examples
isAlpha 'a' == True
isAlpha 'E' == True
isAlpha '0' == False
isAlpha 'π' == FalseisAlphaNum
isAlphaNum : Char -> BoolDetect upper case and lower case ASCII characters, or digits.
Examples
isAlphaNum 'a' == True
isAlphaNum '0' == True
isAlphaNum '-' == False
isAlphaNum 'π' == FalsetoUpper
toUpper : Char -> CharConvert to upper case.
Examples
toUpper 'a' == 'A'
toUpper 'A' == 'A'toLower
toLower : Char -> CharConvert to lower case.
Examples
toLower 'A' == 'a'
toLower 'a' == 'a'toLocaleUpper
toLocaleUpper : Char -> CharConvert to upper case, according to any locale-specific case mappings.
toLocaleLower
toLocaleLower : Char -> CharConvert to lower case, according to any locale-specific case mappings.
toCode
toCode : Char -> IntConvert to the corresponding Unicode code point.
Examples
toCode 'A' == 65
toCode 'B' == 66
toCode '木' == 0x6728
toCode '😃' == 0x1F603fromCode
fromCode : Int -> CharConvert a Unicode code point to a character.
Examples
fromCode 65 == 'A'
fromCode 66 == 'B'
fromCode 0x6728 == '木'
fromCode 0x1F603 == '😃'
fromCode -1 == '�'The full range of unicode is from 0 to 0x10FFFF. With numbers outside that range, you get the replacement character.