Variable type holding a single character System unit
  type : Char = #0..#255;
The Char type is a simple variable type used to hold a single character.
It can be assigned from a character constant, or an integer.
It is not guaranteed to be 1 byte in size - use AnsiChar if this is what you want.
Related commands
AnsiChar A character type guaranteed to be 8 bits in size
Chr Convert an integer into a character
Ord Provides the Ordinal value of an integer, character or enum
PChar A pointer to an Char value
String A data type that holds a string of characters
UpCase Convert a Char value to upper case
WideChar Variable type holding a single International character
 Author links

 Buy Website Traffic at

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

Example code : Different ways of assigning to and from a Char
  myChar  : Char;

  myChar := 'G';                    // Assign from a character constant
  ShowMessage('Letter G = '+myChar);

  myChar := #65;                    // Assign from an integer constant
  ShowMessage('#65 = '+myChar);

  myChar := ^I;                     // Assign from a control char - tab
  ShowMessage('Control '+myChar+' character');

  myChar := Chr(66);                // Using Chr to convert a number
  ShowMessage('Chr(66) = '+myChar);

  myChar := Char(67);               // Using Char as a standard cast
  ShowMessage('Char(67) = '+myChar);
Show full unit code
   Letter G = G
   #65 = A
   Control    character
   Chr(66) = B
   Char(67) = C
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page