Home  |  Delphi .net Home  |  System.Convert  |  ToChar Method
ToChar  
Method  
Converts data from one data type to a Char data type
Convert Class
System NameSpace
CF1.  Function ToChar ( Value : Boolean; ) : Char;
CF2.  Function ToChar ( Value : Byte; ) : Char;
CF3.  Function ToChar ( Value : Char; ) : Char;
CF4.  Function ToChar ( Value : Char; ) : Char;
CF5.  Function ToChar ( Value : SmallInt; ) : Char;
CF6.  Function ToChar ( Value : ShortInt; ) : Char;
CF7.  Function ToChar ( Value : Integer; ) : Char;
CF8.  Function ToChar ( Value : Int64; ) : Char;
CF9.  Function ToChar ( Value : UInt64; ) : Char;
CF10.  Function ToChar ( Value : Word; ) : Char;
CF11.  Function ToChar ( Value : Single; ) : Char;
CF12.  Function ToChar ( Value : Double; ) : Char;
CF13.  Function ToChar ( Value : Decimal; ) : Char;
CF14.  Function ToChar ( Value : DateTime; ) : Char;
CF15.  Function ToChar ( Value : String; ) : Char;
CF16.  Function ToChar ( Value:StringValue : String; FormatProvider : IFormatProvider; ) : Char;
CF17.  Function ToChar ( Value : Object; ) : Char;
CF18.  Function ToChar ( Value:ObjectValue : Object; FormatProvider : IFormatProvider; ) : Char; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to transfer the value from one of the given Value data types to Char.
 
The optional FormatProvider parameter determines the parsing rules and is beyond the scope of this article.
Notes
An exception is thrown if the conversion fails.
Microsoft MSDN Links
System
System.Convert
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  myChar : Char;
  myInt  : Integer;

begin
  myInt  := 65;  // A-Z : 65-90

  myChar := System.Convert.ToChar(myInt);

  Console.WriteLine(myChar);

  Console.ReadLine;
end.
Show full unit code
  A
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author