formatting strings with leading characters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I add characters to an incomplete string. I want it:
Ex:
"12" to "0012"

That's exactly what I need, I prefer using string. If there's no way, I'd
like to know how make an integer to change like the above example.
 
Using integers:

int i = 12;
Console.WriteLine(i.ToString("0000"));

HTH, Jakob.
 

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