right-justify formatted integers

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

How to string format an integer to be right-justified within a field width
of a specified number of characters ?

in the following example , 'x' denotes space character

xxxx0
xxxx1
....
xxxx9
xxx10
xxx11
 
John said:
How to string format an integer to be right-justified within a field width
of a specified number of characters ?

in the following example , 'x' denotes space character

xxxx0
xxxx1
...
xxxx9
xxx10
xxx11

String.Format("{0,5}", v)

is one way.

Arne
 

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

Back
Top