A
Alan Foxmore
Hello all,
Is it possible to use String.Format() to specify a maximum length for a
formatted item? For example, let's say I have:
String.Format("{0}", "FREDDY");
How can I specify that the result of the formatting should be a string
no longer than, say, 3 characters? I know I can easily specify the
minimum length, but I am producing a report with columns. I need to
specify the maximum length, truncating whatever does not fit.
Is it possible without resorting to a custom formatter?
Please note that I want to do this with String.Format() rather than
something like, myString.Substring(0,4);
Thanks.
Is it possible to use String.Format() to specify a maximum length for a
formatted item? For example, let's say I have:
String.Format("{0}", "FREDDY");
How can I specify that the result of the formatting should be a string
no longer than, say, 3 characters? I know I can easily specify the
minimum length, but I am producing a report with columns. I need to
specify the maximum length, truncating whatever does not fit.
Is it possible without resorting to a custom formatter?
Please note that I want to do this with String.Format() rather than
something like, myString.Substring(0,4);
Thanks.