- Up - | Next >> |
The module Char
contains procedures operating on characters. Characters are integers between 0
and 255
, used for building strings. For the encoding of characters by integers, we use the ISO 8859-1 standard [ISO87]. The functionality provided by this module is similar to the ctype.h
module of ANSI C, see for instance [KR88].
The procedures described herein can be used to compute with strings by using the generic procedures of the list module (see Section 6.3). For example,
{Filter "r E!m O\nv7E" Char.isAlpha}
keeps only the letters of the given string and returns the string "rEmOvE"
.
IsChar
{Char.is
+X
?B
}
tests whether X
is a character, i. e., an integer between 0
and 255
inclusively.
isLower
{Char.isLower
+Char
?B
}
tests whether Char
encodes a lower-case letter.
isUpper
{Char.isUpper
+Char
?B
}
tests whether Char
encodes an upper-case letter.
isDigit
{Char.isDigit
+Char
?B
}
tests whether Char
encodes a digit.
isSpace
{Char.isSpace
+Char
?B
}
tests whether Char
encodes a white space character, i. e., either a space, a form feed (&\f
), a newline (&\n
), a carriage return (&\r
), a tab (&\t
), a vertical tab (&\v
) or a non-breaking space (&\240
).
isPunct
{Char.isPunct
+Char
?B
}
tests whether Char
encodes a punctuation character, i. e., a visible character, which is not a space, a digit, or a letter.
isCntrl
{Char.isCntrl
+Char
?B
}
tests whether Char
encodes a control character.
isAlpha
{Char.isAlpha
+Char
?B
}
tests whether Char
encodes a letter.
isAlNum
{Char.isAlNum
+Char
?B
}
tests whether Char
encodes a letter or a digit.
isGraph
{Char.isGraph
+Char
?B
}
tests whether Char
encodes a visible character.
isPrint
{Char.isPrint
+Char
?B
}
tests whether Char
is a visible character or either the space or non-breaking space character.
isXDigit
{Char.isXDigit
+Char
?B
}
tests whether Char
is a hexadecimal digit.
type
{Char.type
+Char
?A
}
maps Char
to its simple type A
, i. e., one of the atoms lower
, upper
, digit
, space
, punct
, or other
.
toLower
{Char.toLower
+Char1
?Char2
}
returns the corresponding lower-case letter if Char1
is an upper-case letter, otherwise Char1
itself.
toUpper
{Char.toUpper
+Char1
?Char2
}
returns the corresponding upper-case letter if Char1
is a lower-case letter, otherwise Char1
itself.
toAtom
{Char.toAtom
+Char
?A
}
maps Char
to the corresponding atom A
. If Char
is zero, A
will be the empty atom ''
.
- Up - | Next >> |