Thread overview | |||||
---|---|---|---|---|---|
|
July 29, 2010 D2: Indexed format specifiers? | ||||
---|---|---|---|---|
| ||||
I could have sworn I saw Andrei say somewhere a while ago that Phobos2 supported posix-style indexed format specifiers. From what I could figure out from some searching that on the web, those are like "%1$s". But this gives me a FormatException: "%1$s".format("A"); And this works fine: "%s".format("A"); Did I get the format wrong? |
July 29, 2010 Re: D2: Indexed format specifiers? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Thursday, July 29, 2010 00:54:27 Nick Sabalausky wrote:
> I could have sworn I saw Andrei say somewhere a while ago that Phobos2 supported posix-style indexed format specifiers. From what I could figure out from some searching that on the web, those are like "%1$s". But this gives me a FormatException:
>
> "%1$s".format("A");
>
> And this works fine:
>
> "%s".format("A");
>
> Did I get the format wrong?
It works with writefln(), so it looks like it's a bug in format().
- Jonathan M Davis
|
July 29, 2010 Re: D2: Indexed format specifiers? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | "Jonathan M Davis" <jmdavisprog@gmail.com> wrote in message news:mailman.49.1280424679.13841.digitalmars-d-learn@puremagic.com... > On Thursday, July 29, 2010 00:54:27 Nick Sabalausky wrote: >> I could have sworn I saw Andrei say somewhere a while ago that Phobos2 supported posix-style indexed format specifiers. From what I could figure out from some searching that on the web, those are like "%1$s". But this gives me a FormatException: >> >> "%1$s".format("A"); >> >> And this works fine: >> >> "%s".format("A"); >> >> Did I get the format wrong? > > It works with writefln(), so it looks like it's a bug in format(). > Hmm, indeed it does work in writefln. Filed: http://d.puremagic.com/issues/show_bug.cgi?id=4532 |
Copyright © 1999-2021 by the D Language Foundation