Convert Integer to String (Solved)

Started by ryandebraal, Sun 24/02/2013 11:05:20

Previous topic - Next topic

ryandebraal

I don't know why I can't find this in Search or on Google.

I can to convert an int to a String.

I've looekd in documentation, and I see you can convert String to int with .AsInt - but there doesn't seem to be a matching function to do it in the other direction

COuld someone clue me in please?

zabnat

Read the manual entry for String formatting.

Basically it goes like this:
Code: AGS
int number = 2;
String number_as_text = String.Format("%d", number);
String number_in_text = String.Format("The number is %d", number);

ryandebraal

Thanks :)

I did read the manual entry and it never mentions the String.Format function, only how to inject an integer value into a Display function using a special character (%d)

Display("The meaning of life is %d.", life);
http://www.adventuregamestudio.co.uk/manual/StringFormats.htm

Khris

String.Format is mentioned and linked to in the very first sentence of that manual page...

ryandebraal

you're correct, my oversight.

SMF spam blocked by CleanTalk