Description |
The IntToStr function converts an Integer Number or Int64 BigNumber into a string.
It has two forms : the latter supporting very large integers.
It is normally used for display purposes.
|
|
Related commands |
FloatToStr |
|
Convert a floating point value to a string |
Format |
|
Rich formatting of numbers and text into a string |
StrToInt |
|
Convert an integer string into an Integer value |
|
|
|
Example code : Converting integers to strings |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses SysUtils, // Unit containing the IntToStr command Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
NormalInteger : Integer;
BigInteger : Int64;
begin NormalInteger := 2147483647; // Largest possible Integer value BigInteger := 9223372036854775807; // Largest possible Int64 value
ShowMessage('NormalInteger : '+IntToStr(NormalInteger));
ShowMessage('BigInteger : '+IntToStr(BigInteger));
ShowMessage('Calculated number : '+IntToStr(27 * 4));
end; end.
|
Hide full unit code |
NormalInteger : 2147483647
BigInteger : 9223372036854775807
Calculated number : 108
|
|