About string and int spliced together.

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jul 30 19:18:24 UTC 2020


On Thu, Jul 30, 2020 at 06:59:11PM +0000, zoujiaqing via Digitalmars-d wrote:
[...]
> The simplest way:
> 
> int i = 99;
> 
> string a = "text " ~ i ~ "!";
> 
> writeln(a); // text 99!

You could just use std.conv.text:

	int i = 99;
	string a = text("blah ", i, "!");
	writeln(a);	// blah 99!


T

-- 
MASM = Mana Ada Sistem, Man!


More information about the Digitalmars-d mailing list