About string and int spliced together.
Kagamin
spam at here.lot
Thu Jun 18 09:44:15 UTC 2020
On Thursday, 18 June 2020 at 09:00:42 UTC, zoujiaqing wrote:
> It should be:
>
> ```D
> import std.stdio;
>
> void main()
> {
> string name = "Brian";
> uint age = 18;
>
> string text = "My name is " ~ name ~ " and my age is " ~
> age ~ ".";
>
> writeln(text);
> }
> ```
You can use https://dlang.org/phobos/std_conv.html#text
string s = text("My name is ", name, " and my age is ", age, ".");
More information about the Digitalmars-d
mailing list