Home All Groups Group Topic Archive Search About

How to format string add commas at thousand position?

Author
11 Mar 2006 6:46 PM
Netmonster
All,

How to format string add commas at thousands position, and hundred
thousands position

Example 1: I have string s = "1001"; or could be a random number I want
the output to be 1,001.

Example 2 : I have string s = "1000001"; or could be a random number I
want the output to be 1,000,001.



Thanks in advance

KC

Author
11 Mar 2006 7:29 PM
Tim Wilson
You can use the "N" format specifier.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.asp

--
Tim Wilson
..NET Compact Framework MVP

Show quoteHide quote
"Netmonster" <netmonster***@yahoo.com> wrote in message
news:1142102763.790669.76860@v46g2000cwv.googlegroups.com...
> All,
>
> How to format string add commas at thousands position, and hundred
> thousands position
>
> Example 1: I have string s = "1001"; or could be a random number I want
> the output to be 1,001.
>
> Example 2 : I have string s = "1000001"; or could be a random number I
> want the output to be 1,000,001.
>
>
>
> Thanks in advance
>
> KC
>
Are all your drivers up to date? click for free checkup

Author
11 Mar 2006 7:29 PM
Otis Mukinfus
Show quote Hide quote
On 11 Mar 2006 10:46:03 -0800, "Netmonster" <netmonster***@yahoo.com> wrote:

>All,
>
>How to format string add commas at thousands position, and hundred
>thousands position
>
>Example 1: I have string s = "1001"; or could be a random number I want
>the output to be 1,001.
>
>Example 2 : I have string s = "1000001"; or could be a random number I
>want the output to be 1,000,001.
>
>
>
>Thanks in advance
>
>KC
Look up string.Format in the documentation.

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com

Bookmark and Share