Functions for working with characters. Character literals are enclosed in
'a' pair of single quotes.
Detect upper case ASCII characters.
isUpper 'A' == True
isUpper 'B' == True
...
isUpper 'Z' == True
isUpper '0' == False
isUpper 'a' == False
isUpper '-' == False
isUpper 'Σ' == FalseDetect lower case ASCII characters.
isLower 'a' == True
isLower 'b' == True
...
isLower 'z' == True
isLower '0' == False
isLower 'A' == False
isLower '-' == False
isLower 'π' == FalseDetect upper case and lower case ASCII characters.
isAlpha 'a' == True
isAlpha 'b' == True
isAlpha 'E' == True
isAlpha 'Y' == True
isAlpha '0' == False
isAlpha '-' == False
isAlpha 'π' == FalseDetect upper case and lower case ASCII characters.
isAlphaNum 'a' == True
isAlphaNum 'b' == True
isAlphaNum 'E' == True
isAlphaNum 'Y' == True
isAlphaNum '0' == True
isAlphaNum '7' == True
isAlphaNum '-' == False
isAlphaNum 'π' == FalseDetect digits 0123456789
isDigit '0' == True
isDigit '1' == True
...
isDigit '9' == True
isDigit 'a' == False
isDigit 'b' == False
isDigit 'A' == FalseDetect octal digits 01234567
isOctDigit '0' == True
isOctDigit '1' == True
...
isOctDigit '7' == True
isOctDigit '8' == False
isOctDigit 'a' == False
isOctDigit 'A' == FalseDetect hexidecimal digits 0123456789abcdefABCDEF
Convert to upper case, according to any locale-specific case mappings.
Convert to lower case, according to any locale-specific case mappings.
Convert to the corresponding Unicode code point.
toCode 'A' == 65 toCode 'B' == 66 toCode '木' == 0x6728 toCode '𝌆' == 0x1D306 toCode '😃' == 0x1F603
Convert a Unicode code point to a character.
fromCode 65 == 'A'
fromCode 66 == 'B'
fromCode 0x6728 == '木'
fromCode 0x1D306 == '𝌆'
fromCode 0x1F603 == '😃'
fromCode -1 == '�'The full range of unicode is from 0 to 0x10FFFF. With numbers outside that
range, you get the replacement character.
A
Charis a single unicode character:Note 1: You cannot use single quotes around multiple characters like in JavaScript. This is how we distinguish
StringandCharvalues in syntax.Note 2: You can use the unicode escapes from
\u{0000}to\u{10FFFF}to represent characters by their code point. You can also include the unicode characters directly. Using the escapes can be better if you need one of the many whitespace characters with different widths.