The members of the domain Character are values representing letters, numerals and other text elements.
Characters can be obtained using String notation.
chars := [char "a", char "A", char "X", char "8", char "+"]
[a,A,X,8,+]
Type: List Character
Certain characters are available by name. This is the blank character.
space()
Type: Character
This is the quote that is used in strings.
quote()
"
Type: Character
This is the escape character that allows quotes and other characters within strings.
escape()
_
Type: Character
Characters are represented as integers in a machine-dependent way. The integer value can be obtained using the ord operation. It is always true that char(ord c) = c and ord(char i) = i, provided that i is in the range 0..size()$Character-1.
[ord c for c in chars]
[97,65,88,56,43]
Type: List Integer
The lowerCase operation converts an upper case letter to the corresponding lower case letter. If the argument is not an upper case letter, then it is returned unchanged.
[upperCase c for c in chars]
[A,A,X,8,+]
Type: List Character
The upperCase operation converts lower case letters to upper case.
[lowerCase c for c in chars]
[a,a,x,8,+]
Type: List Character
A number of tests are available to determine whether characters belong to certain families.
[alphabetic? c for c in chars]
[true,true,true,false,false]
Type: List Boolean
[upperCase? c for c in chars]
[false,true,true,false,false]
Type: List Boolean
[lowerCase? c for c in chars]
[true,false,false,false,false]
Type: List Boolean
[digit? c for c in chars]
[false,false,false,true,false]
Type: List Boolean
[hexDigit? c for c in chars]
[true,true,false,true,false]
Type: List Boolean
[alphanumeric? c for c in chars]
[true,true,true,true,false]
Type: List Boolean
See Also: