Home  |  Delphi .net Home  |  System.Convert  |  ToSByte Method
ToSByte  
Method  
Converts data from one data type to a SByte data type
Convert Class
System NameSpace
CF1.  Function ToSByte ( Value : Boolean; ) : SByte;
CF2.  Function ToSByte ( Value : Cardinal; ) : SByte;
CF3.  Function ToSByte ( Value : Byte; ) : SByte;
CF4.  Function ToSByte ( Value : Char; ) : SByte;
CF5.  Function ToSByte ( Value : SmallInt; ) : SByte;
CF6.  Function ToSByte ( Value : ShortInt; ) : SByte;
CF7.  Function ToSByte ( Value : Integer; ) : SByte;
CF8.  Function ToSByte ( Value : Int64; ) : SByte;
CF9.  Function ToSByte ( Value : UInt64; ) : SByte;
CF10.  Function ToSByte ( Value : Word; ) : SByte;
CF11.  Function ToSByte ( Value : Single; ) : SByte;
CF12.  Function ToSByte ( Value : Double; ) : SByte;
CF13.  Function ToSByte ( Value : Decimal; ) : SByte;
CF14.  Function ToSByte ( Value : DateTime; ) : SByte;
CF15.  Function ToSByte ( Value : String; ) : SByte;
CF16.  Function ToSByte ( Value:StringValue : String; FormatProvider : IFormatProvider; ) : SByte;
CF17.  Function ToSByte ( Value : Object; ) : SByte;
CF18.  Function ToSByte ( Value:ObjectValue : Object; FormatProvider : IFormatProvider; ) : SByte; 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 Byte.
 
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
  mySByte : SByte;
  myStr   : String;

begin
  myStr  := '-123';

  mySByte := System.Convert.ToSByte(myStr);

  Console.WriteLine(mySByte.ToString);

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