30

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?

3
  • 5
    I'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? Commented Dec 31, 2009 at 20:52
  • 2
    google.pl/… - and you have answer after 1 sec Commented Dec 31, 2009 at 21:12
  • 4
    @inzKulozik, I would love SO to be the first link when someone else googles it! Commented Dec 31, 2009 at 23:12

2 Answers 2

47

You can use IntToStr:

A:=IntToStr(123)
Sign up to request clarification or add additional context in comments.

Comments

3

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.

1 Comment

Ticks is not an object. You stumbled on the intrinsic record helper for simple types, see Integer Type Helpers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.