M
MC
In C, printf allows us to specify a runtime (non-constant) field width
of a formatted value by using the * character. Is there something
like that for System.String.Format? In C#, I find myself having to
use concatenation, which is awkward to write and to read:
s.Format("{0," + fieldWidth.ToString() + "}", val);
Preferably, I'd like to nest two placeholders, like this:
s.Format("{0,{1}}", val, fieldWidth);
but it doesn't like that (Framework 2.0).
Is currently available somehow? I didn't see it in MSDN. If not, was
there never any noise about the lack of it in Framework 1.x?? And are
there any plans to add it in the near future?
Thanks,
Craig
of a formatted value by using the * character. Is there something
like that for System.String.Format? In C#, I find myself having to
use concatenation, which is awkward to write and to read:
s.Format("{0," + fieldWidth.ToString() + "}", val);
Preferably, I'd like to nest two placeholders, like this:
s.Format("{0,{1}}", val, fieldWidth);
but it doesn't like that (Framework 2.0).
Is currently available somehow? I didn't see it in MSDN. If not, was
there never any noise about the lack of it in Framework 1.x?? And are
there any plans to add it in the near future?
Thanks,
Craig