digitalmars.D.learn - Explicit ordering with std.format
- =?iso-8859-2?B?VG9tZWsgU293afFza2k=?= (7/7) Dec 04 2009 An extract from java.util.Formatter docs:
- bearophile (4/5) Dec 05 2009 I think you can't (and I haven't had the need to do it).
- Ary Borenszweig (2/6) Dec 05 2009 It's somtimes needed with I18N code.
- Joel Christensen (3/14) Dec 05 2009 With the D Tango library you can put:
An extract from java.util.Formatter docs: // Explicit argument indices may be used to re-order output. formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d") // -> " d c b a" How do I achieve this with std.format? The ddocs only say that "variadic arguments are consumed in order". Any way to change that order? Tomek
Dec 04 2009
Tomek Sowiński:How do I achieve this with std.format?I think you can't (and I haven't had the need to do it). Bye, bearophile
Dec 05 2009
bearophile wrote:Tomek Sowiński:It's somtimes needed with I18N code.How do I achieve this with std.format?I think you can't (and I haven't had the need to do it).
Dec 05 2009
Tomek Sowiński wrote:An extract from java.util.Formatter docs: // Explicit argument indices may be used to re-order output. formatter.format("%4$2s %3$2s %2$2s %1$2s", "a", "b", "c", "d") // -> " d c b a" How do I achieve this with std.format? The ddocs only say that "variadic arguments are consumed in order". Any way to change that order? TomekWith the D Tango library you can put: Stdout.format("{3} {2} {1} {0}", "a", "b", "c", "d");
Dec 05 2009