On Monday, 9 April 2012 at 17:09:03 UTC, Andrej Mitrovic wrote:
import std.string;

void main()
{
    string foo = "foo";
    string bar = format("%s %s %s", foo);
}

format expects 3 arguments, but what I really want is foo to be used for all 3 specifiers and not repeat 'foo' 3 times manually. Are there any format specifiers that do what I want? I've tried using positional
specifiers but that didn't work:

string bar = format("%1$s %1$s %1$s", foo);
$ std.format.FormatException@std\format.d(4363): string

That's a great error message btw.

Positional specifier works just fine for me.

Reply via email to