Convert Integer Into String
60,021
Solution 1
You can use IntToStr
:
A:=IntToStr(123)
Solution 2
I just did my first steps with a 30day test version of Delphi XE8 and figured out that one has to write e.g.
Ticks: integer;
LabelTicks: TLabel;
(...)
LabelTicks.Text:= System.SysUtils.IntToStr( Ticks);
But: The variable 'Ticks' seems to be an object! I did not expect that, but you can also write
LabelTicks.Text:= Ticks.ToString;
To me that seems to be much more elegant.
Related videos on Youtube
Author by
Nathan Campos
Electrical Engineer, Ham radio operator, photographer, used to be a programmer.
Updated on June 15, 2020Comments
-
Nathan Campos almost 4 years
I have a some numbers stored in a
Integer
calledmode
, but I need to use they in aTProcess
. For this I need to convert theInteger
into aString
, because if I don't do this, I got the error:Incompatible types: got "LongInt" expected "AnsiString"
Then I want to know how I can convert a
Integer
into aString
?-
Rob Kennedy over 14 yearsI'd like the two people who voted down this question to come forward. What's not useful about this question? Is it unclear? What part of No question is too trivial or too "newbie" do you not understand?
-
inzKulozik over 14 yearsgoogle.pl/… - and you have answer after 1 sec
-
notnoop over 14 years@inzKulozik, I would love SO to be the first link when someone else googles it!
-
-
LU RD almost 9 years
Ticks
is not an object. You stumbled on the intrinsic record helper for simple types, see Integer Type Helpers.