On Wednesday, 19 April 2017 at 00:08:19 UTC, Walter Bright wrote:
On 4/18/2017 2:56 PM, Jonathan Marler wrote:
Have you thought about supporting format specifiers as well? I looked at the C# version and it looks like they can specify them using a colon like this:

    $"{a} in hex is {a:x}"

There are additional problems, such as:

    $"{a} in %s {b}"

and positional parameters:

    $"{a} in {0}"

Of course, the easiest solution is to just disallow that stuff.

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.









Reply via email to