Convert Integer Into String
Question
I have a some numbers stored in a Integer
called mode
, but I need to use they in a TProcess
. For this I need to convert the Integer
into a String
, 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 a String
?
Solution
You can use IntToStr
:
A:=IntToStr(123)
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow