R
Roger Helliwell
Hello Everyone,
Has anyone found a quick reference for the many string formatting
options for string.Format() ? I'm spending a ridiculous amount of time
trying to write one line of code that would take about 3 seconds in C.
(Sarcasm not intended.)
All I need is a format string to zero pad an integer out to 9 digits.
[C]
int n = 1234;
printf("PU%09", n); // Displays "PU000001234"
[C#]
int n = 1234;
string pu = string.Format("{0}", n); // How to pad to 9 digits?
If anyone has a link to the full format string syntax, let me
know--I'll probably run into a similar problem in the future. (MSDN
was no help.)
Many thanks,
Roger
Has anyone found a quick reference for the many string formatting
options for string.Format() ? I'm spending a ridiculous amount of time
trying to write one line of code that would take about 3 seconds in C.
(Sarcasm not intended.)
All I need is a format string to zero pad an integer out to 9 digits.
[C]
int n = 1234;
printf("PU%09", n); // Displays "PU000001234"
[C#]
int n = 1234;
string pu = string.Format("{0}", n); // How to pad to 9 digits?
If anyone has a link to the full format string syntax, let me
know--I'll probably run into a similar problem in the future. (MSDN
was no help.)
Many thanks,
Roger