Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format a number a specific way

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hello I need to format int,12345678 as 1.23.45.678

What style can I use?

I have tried several and nothing is working

I do not want to have to style the string manually. I was hoping something like this would work:
Code:
string.Format("{0:#.##.##.###}", 12345678)
but it doesn't.


Thanks,
RalphTrent


 
OK I figured it out.

Code:
 Console.WriteLine(string.Format("{0:0\\.00\\.00\\.000}", 12345678));

returns
[green]
1.23.45.678
[/green]

I guess i needed to escape the decimal points.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top