String Format Question

B

Bishman

Hi,

A quick one for someone hopefully.....

How do I return a string "003" from the integer 3 ?

I believe its something like:

int tempval = 3;
string tempstr = String.Format("{0???}",tempval);

??? = Thats where I am stuck !

I dont find the Help particuarly helpfull on this one

Any ideas please,

Thanks in advance

Jon
 
N

nick_nw

Bishman said:
Hi,

A quick one for someone hopefully.....

How do I return a string "003" from the integer 3 ?

I believe its something like:

int tempval = 3;
string tempstr = String.Format("{0???}",tempval);

??? = Thats where I am stuck !

I dont find the Help particuarly helpfull on this one

Any ideas please,

Thanks in advance

Jon

string tempstr = tempval.ToString ("000");

Hope that helps,

Nick
http://seecharp.blogspot.com/
 

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