How in D would I cast integer to string? Something like
int i = 15 string message = "Value of 'i' is " ~ toString(i); // cast(string) i - also does not work
Google brought me the answer on how to do it with tango, but I want the phobos version.
import std.conv; int i = 15; string message = "Value of 'i' is " ~ to!string(i);
or format:
format
import std.string; string message = format("Value of 'i' is %s.", i);
import std.conv; auto i = 15; auto message = text("Value of 'i' is ", i);
there are also wtext an dtext variants witch returns wstring and dstring.
Use to from std.conv:
to
int i = 15 string message = "Value of 'i' is " ~ to!string(i);
or
format
: