DelphiBasics
WideChar
Type
Variable type holding a single International character System unit
type : WideChar = #0..#65535;
Description
The WideChar type is a simple variable type used to hold a single character that supports International character sets.
 
WideChar types are 16 bits in size, providing support for multi-byte International character sets such as Chinese, which have vast numbers of characters (idiograms) in their character sets.
 
It can be assigned from a character constant, or an integer.
Related commands
CharVariable type holding a single character
PWideCharPointer to a WideChar
WideStringA data type that holds a string of WideChars
 Download this web site as a Windows program.




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

begin
  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 := WideChar(67);          // Using WideChar as a standard cast
  ShowMessage('WideChar(67) = '+myChar);
end;
Show full unit code
  Letter G = G
  #65 = A
  Control character
  Chr(66) = B
  WideChar(67) = C
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page