Description |
The Chr function converts an IntValue integer into either an AnsiChar or WideChar as appropriate.
|
|
Notes |
The ansi character set includes control characters such as Chr(27) meaning escape.
Chr(65) gives 'A'
Note that ^A is equivalent to Char(1).
|
|
Related commands |
Char |
|
Variable type holding a single character |
Ord |
|
Provides the Ordinal value of an integer, character or enum |
Val |
|
Converts number strings to integer and floating point values |
|
|
|
Example code : Showing Chr and ^ usage |
var
tab : char;
crlf : string;
begin // Show the use of Chr
tab := Chr(9);
crlf := Chr(13)+Chr(10);
ShowMessage('Hello'+tab+'World');
ShowMessage('');
ShowMessage('Hello'+crlf+'World');
ShowMessage('');
// Show the equivalent use of ^ tab := ^I; // I = 9th capital of the alphabet crlf := ^M^J; // M = 13th, J = 10th letters
ShowMessage('Hello'+tab+'World');
ShowMessage('');
ShowMessage('Hello'+crlf+'World');
end;
|
Show full unit code |
Hello World
Hello
World
Hello World
Hello
World
|
|