string formatting question

  • Thread starter Gregory Khrapunovich
  • 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
 
G

Gregory Khrapunovich

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
 
A

amaca

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top