- 2.2.6.2 -
TMT Pascal Language Description
Pascal Language Structure
TypesCharacter Types
There are two base character types: Char and WChar. Char values are byte-sized
(8-bit) characters ordered according to the extended ANSI character set.
WideChar ones are word-sized (16-bit) characters ordered according to the
Unicode character set. The first 256 Unicode characters correspond to the ANSI
characters. Unicode character sets are widely used for Asian languages.
TMT Pascal supports both single-byte and multi-byte character strings through
the PChar, PWChar types which are defined as follows:
type
PChar = ^Char;
PWChar = ^WChar;
The code fragment below shows various ways to initialize character type
variables.
var
Bell, EofMarker: Char;
Number, Alpha: WChar;
begin
Number := '5';
Alpha := 'a';
Bell := ^G;
EofMarker := #27;
end.
A character is normally delimited by two single quotes.
However there are two other methods of representing characters as seen in the
example above: the caret symbol (^) and the number symbol (#).
Use the caret to represent control codes -- characters between 0 and 31 on the
ASCII table. ^G stands for character number 7 because G is the seventh letter
of the alphabet. When ^G is used during output the computer's bell will sound.
Use # to represent any ASCII character. As in the example above, the end of
file character, which is defined as character number 27 on the ASCII table, is
assigned to the variable EofMarker. Note that #27 is the same as
^[.
|
|
|
Boolean Types |
Table of Content |
Integer Types |
- 2.2.6.2 -