Interpolated strings
Jonas Drewsen via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 17 12:41:14 PDT 2017
On Monday, 17 April 2017 at 19:12:37 UTC, Martin Tschierschke
wrote:
> defining a new method exho! (derived from echo + mixin...:-)
>
> auto exho(string x)(){
> return mixin("writeln("~interp!x~")");}
>
> You can just write:
>
> exho!"The number ${num} doubled is ${num * 2}!"
It requires 'num' to be available to the exho function definition
so will not
work in the general case.
More information about the Digitalmars-d
mailing list