DelphiBasics
Chr
Function
Convert an integer into a character System unit
1  function Chr ( IntValue : Integer ) : AnsiChar;
2  function Chr ( IntValue : Integer ) : WideChar;
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
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.


 
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
  
 
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page