blob: 5bda343e87aac54a66dcd3fcc97a485845fedbde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
% 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}
%
|