On Thursday, 21 May 2020 at 01:13:27 UTC, Paul Backus wrote:
On Wednesday, 20 May 2020 at 23:41:15 UTC, mw wrote:
Can we do string interpolation in D now?

There's an implementation in the dub package "scriptlike":

https://code.dlang.org/packages/scriptlike#string-interpolation

Thank you! very nice:

// Output: The number 21 doubled is 42!
int num = 21;
writeln( mixin(interp!"The number ${num} doubled is ${num * 2}!") );

Is there any way to make it shorter? e.g.

writeln( s!"The number ${num} doubled is ${num * 2}!" );

i.e how to write this 's'?

Reply via email to