Char
Standard library for character operations.
Functions in this module operate on type Char, a character that is
represented by a single unicode codepoint. A codepoint is a numerical value
that maps to a character, as per the unicode standard. Literal characters can
be created with single quotes, such as in 'a' or '7', and escape
sequences are supported, as in '\n' and '\t'.
To import all names from this module, use:
import Char (*)
With no import, you can still access anything with the prefix Char., like Char.to_lower.
Index
| Name | Type | Description |
|---|---|---|
Char -> Char | Returns the lowercase form of | |
Char -> Char | Returns the uppercase form of | |
Char -> Bool | Returns true if | |
Char -> Bool | Returns true if | |
Char -> Bool | Returns true if | |
Char -> Bool | Returns true if | |
Char -> Bool | Returns true if | |
Char -> Int | Converts | |
Char -> Atom | Converts |
Functions
to_lower : Char -> Char to_lower(ch)
Returns the lowercase form of ch. If ch isn't a letter, returns ch.
assert to_lower('a') == 'a' assert to_lower('B') == 'b' assert to_lower('.') == '.'
to_upper : Char -> Char to_upper(ch)
Returns the uppercase form of ch. If ch isn't a letter, returns ch.
assert to_upper('a') == 'A' assert to_upper('B') == 'B' assert to_upper('3') == '3'
lower? : Char -> Bool lower?(ch)
Returns true if ch is a lowercase letter.
assert lower?('a') assert !lower?('B') assert !lower?(',')
upper? : Char -> Bool upper?(ch)
Returns true if ch is an uppercase letter.
assert !upper?('a') assert upper?('B') assert !upper?('[')
letter? : Char -> Bool letter?(ch)
Returns true if ch is a letter (unicode category L).
assert letter?('m') assert letter?('X') assert !letter?('7') assert !letter?(')')
digit? : Char -> Bool digit?(ch)
Returns true if ch is a digit (unicode category Nd).
assert digit?('5') assert digit?('0') assert !digit?('b') assert !digit?('"')
whitespace? : Char -> Bool whitespace?(ch)
Returns true if ch is whitespace (unicode property
WSpace=yes).
assert whitespace?('\t') assert whitespace?('\n') assert !whitespace?('s') assert !whitespace?('9')
Implementations
impl ToInt for Char
The following functions are from the ToInt interface.
to_int : Char -> Int to_int(a)
Converts a to an integer. See the full description in the ToInt interface.
impl ToAtom for Char
