I am trying to make a pure function that embeds a number in a string. The obvious concatenation methods do not work:
pure string foo(immutable int bar)
{
return "Number: " ~ bar; // Error: strings and ints are incompatible.
return "Number: " ~ to!string(bar); // Error: to() is impure.
}
Is there a clean, functional way to concatenate a number and string? I would like to avoid writing my own concatenation or conversion function, but I will if I have to.