string formatting question

  • Thread starter Thread starter Gregory Khrapunovich
  • Start date Start date
G

Gregory Khrapunovich

I am sorry to bother you with such a simple question. I need to print 4
columns containing integers, 8 char column width. I cannot find how to
format an integer for 8 characters. Statements like i.ToString("G8") or
i.ToString("D8") do not work (first doesn't create empty spaces, second
fills extra spaces with zeros).
Gregory
 
Thank you. I tried them all. The one that works is:
String.Format("{0,8}{1,8}",i, j);

I wouldn't say it's entirely obvious :)
Gregory
 
Strangely, I was hunting for this just today. Talk about a maze of twisty
passages all the same, none going where you need to go.

Andrew
 
Back
Top