Interpolated strings

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 19 05:03:47 PDT 2017


On Wednesday, 19 April 2017 at 11:59:51 UTC, Jonas Drewsen wrote:

> What about supporting an optional prefix inside the {} like:
>
> int year = 2017;
> format($"The date is {%04d year}");
>
> so if there is a % immediately following the { then the chars 
> until next whitespace is format specifier. You can of course 
> leave out the format specifier and it will default to %s.
I really don't see how string interpolation is better then
` "The date is " ~ format("%04d", year)); `



More information about the Digitalmars-d mailing list