Re: Number formatting question by Peter
Peter
Wed Jan 23 11:09:58 CST 2008
On Wed, 23 Jan 2008 07:47:10 -0800, Scott Roberts
<sroberts@no.spam.here-webworks-software.com> wrote:
> How about this:
>
> i.ToString().PadLeft(' ',8);
Noting, however, that the original question appears to be intended to use
the technique for aligning the columns. Since spaces are not the same
width as numbers for all fonts, the technique will only work with certain
fonts.
As long as the OP can always use a specific font that he knows will work
(monospace ones being most reliable, obviously) this is fine. But
otherwise, he'll want to do the formatting not by padding with spaces, but
by actually measuring the width of the numeric string and drawing it in a
specific place.
Pete