2012-05-24 6 views

ответ

20
import std.conv; 

int i = 15; 
string message = "Value of 'i' is " ~ to!string(i); 

или format:

import std.string; 
string message = format("Value of 'i' is %s.", i); 
+0

до просто блестящий :) – Trass3r

7

Использование to из std.conv:

int i = 15 
string message = "Value of 'i' is " ~ to!string(i); 
3
import std.conv; 
auto i = 15; 
auto message = text("Value of 'i' is ", i); 

есть также wtext DTEXT вариантов ведьма возвращается wstring и dstring.