% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\CharacterXmpTitle}{Character}
\newcommand{\CharacterXmpNumber}{9.8}
%
% =====================================================================
\begin{page}{CharacterXmpPage}{9.8 Character}
% =====================================================================
\beginscroll

%
%
%
%
%



The members of the domain \spadtype{Character} are values
representing letters, numerals and other text elements.
For more information on related topics, see
\downlink{`CharacterClass'}{CharacterClassXmpPage}\ignore{CharacterClass} and \downlink{`String'}{StringXmpPage}\ignore{String}.

\xtc{
Characters can be obtained using \spadtype{String} notation.
}{
\spadpaste{chars := [char "a", char "A", char "X", char "8", char "+"] \bound{chars}}
}
\xtc{
Certain characters are available by name.
This is the blank character.
}{
\spadpaste{space()}
}
\xtc{
This is the quote that is used in strings.
}{
\spadpaste{quote()}
}
\xtc{
This is the escape character that allows quotes and other characters
within strings.
}{
\spadpaste{escape()}
}
\xtc{
Characters are represented as integers in a machine-dependent way.
The integer value can be obtained using the \spadfunFrom{ord}{Character}
operation.
It is always true that \spad{char(ord c) = c} and \spad{ord(char i) = i},
provided that \spad{i} is in the range \spad{0..size()\$Character-1}.
}{
\spadpaste{[ord c for c in chars] \free{chars}}
}

\xtc{
The \spadfunFrom{lowerCase}{Character} 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.
}{
\spadpaste{[upperCase c for c in chars] \free{chars}}
}
\xtc{
Likewise, the \spadfunFrom{upperCase}{Character} operation converts lower
case letters to upper case.
}{
\spadpaste{[lowerCase c for c in chars] \free{chars}}
}

\xtc{
A number of tests are available to determine whether characters
belong to certain families.
}{
\spadpaste{[alphabetic? c for c in chars] \free{chars}}
}
\xtc{
}{
\spadpaste{[upperCase? c for c in chars] \free{chars}}
}
\xtc{
}{
\spadpaste{[lowerCase? c for c in chars] \free{chars}}
}
\xtc{
}{
\spadpaste{[digit? c for c in chars] \free{chars}}
}
\xtc{
}{
\spadpaste{[hexDigit? c for c in chars] \free{chars}}
}
\xtc{
}{
\spadpaste{[alphanumeric? c for c in chars] \free{chars}}
}
\endscroll
\autobuttons
\end{page}
%
