T
tstephan
In the docs for String.Format there is an alignment component which
allows you to pad the field to a certain number of spaces.
e.g.
FormatFName = String.Format("First Name = |{0,10}|", myFName);
Pads myFName, width of 10 minimum
I am used to printf which allows a '*' to be used to specify a
variable to be used at runtime to specify the width of the column.
e.g.
printf("%*s", iColWidth, myFName);
Pads myFName, width of iColWidth minimum
Am I missing something or did we lose that power in C#? I would hate
to have to build my format string at runtime just to do this.
allows you to pad the field to a certain number of spaces.
e.g.
FormatFName = String.Format("First Name = |{0,10}|", myFName);
Pads myFName, width of 10 minimum
I am used to printf which allows a '*' to be used to specify a
variable to be used at runtime to specify the width of the column.
e.g.
printf("%*s", iColWidth, myFName);
Pads myFName, width of iColWidth minimum
Am I missing something or did we lose that power in C#? I would hate
to have to build my format string at runtime just to do this.