How to cast a int to a string?

Chris Pons cmpons at gmail.com
Tue Mar 6 15:13:54 PST 2012


I'm trying to update a string easily whenever I change a numeric 
component of the string. I've tried to do this so far with no 
result:

while( testInt < 10 )
string testString = "Test ";
int testInt = 0;
testString ~= toString(testInt)
testInt++;

or this:

testString ~= cast(string)(testInt)

Both of these give an error.

This however does not, but it also doesn't seem to update 
testString

I've also tried this:

testString ~= cast(char)(testInt);

It doens't throw an error, but it doesnt' seem to work either.

For the record, i'm not using writln to print to console, this is 
through SDL and OpenGL so it should be a string.



More information about the Digitalmars-d-learn mailing list