Number Formatting Question C#

  • Thread starter Thread starter probashi
  • Start date Start date
P

probashi

Hi

I want to format numbers with leading zeros

Like:

Input output

0 00
1 01
2 02
10 10
11 11

Thanks
 
int i = 0;
string s = i.ToString("00"); // "00"

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
try:
for (int i = 0; i < 100; ++i){
Response.Write(i.ToString("00"));
Response.Write("<Br />");
}

for the win!
 
Back
Top