About string and int spliced together.

Seb seb at wilzba.ch
Thu Jun 18 10:27:01 UTC 2020


On Thursday, 18 June 2020 at 10:19:25 UTC, JN wrote:
> On Thursday, 18 June 2020 at 09:44:15 UTC, Kagamin wrote:
>> You can use https://dlang.org/phobos/std_conv.html#text
>> string s = text("My name is ", name, " and my age is ", age, 
>> ".");
>
> That looks actually quite nifty, I'll have to use that someday. 
> Still it requires an import for std.conv, and when you import 
> std.conv you might as well just to!string all the way.
>
> Imagine if using ~ required import std.concat, I am sure it 
> will be used more sparingly than it is now.

You can just add a "import std" at the top of your module and 
stop worrying about imports.


More information about the Digitalmars-d mailing list