471,348 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

string.Format using Thousands Separator

I know how to format a string to use decimal places:

Code:
Console.WriteLine(string.Format("$ {0:0.00}", 4));
Output:
$ 4.00

How would I format a string to use the Thousands Separator?

for (int i = 0; i < 1000000; i++) // zero to one million
{
Console.WriteLine(string.Format("$ {0:voodoo}", i));
}

What would I replace "voodoo" with?

Thanks.
Aug 27 '08 #1
2 12176
On Wed, 27 Aug 2008 09:17:01 -0700, jp2msft
<jp*****@discussions.microsoft.comwrote:
[...]
How would I format a string to use the Thousands Separator?
See: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Aug 27 '08 #2
jp2msft wrote:
How would I format a string to use the Thousands Separator?

for (int i = 0; i < 1000000; i++) // zero to one million
{
Console.WriteLine(string.Format("$ {0:voodoo}", i));
}

What would I replace "voodoo" with?
Console.WriteLine("$ {0:#,##0.00}", i);

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Douglas | last post: by
3 posts views Thread by Tim Osborne | last post: by
5 posts views Thread by raffelm | last post: by
7 posts views Thread by Alpha | last post: by
3 posts views Thread by mavrick101 | last post: by
8 posts views Thread by Lucky | last post: by
15 posts views Thread by James | last post: by
3 posts views Thread by =?Utf-8?B?THVpZ2k=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.