Integer to String
bearophile
bearophileHUGS at lycos.com
Wed Jan 30 03:18:14 PST 2008
naryl:
> import tango.text.convert.Integer;
> int x = 37;
> char[] y = toString(x);
That sounds too much deep, what about something like:
import tango.text;
auto s = toString(37);
Or:
import tango.text;
auto s = str(37);
Or (no imports, but this requires compiler support):
auto s = cast(string)37;
Or maybe best of all:
auto s = string(37);
I think the design of a good simple way of doing things is very important.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list