473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to format string add commas at thousand position?

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

Mar 11 '06 #1
2 3981
You can use the "N" format specifier.
http://msdn.microsoft.com/library/de...matstrings.asp

--
Tim Wilson
..NET Compact Framework MVP

"Netmonster" <ne***********@yahoo.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.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

Mar 11 '06 #2
On 11 Mar 2006 10:46:03 -0800, "Netmonster" <ne***********@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
Mar 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: stevek | last post by:
How do I format an integer. Add commas. 1234565 1,234,565 TIA
1
by: nic | last post by:
Hi, I have a textbox value that I need to force (and format) to be a numeric value. For example, I want to allow a user to type 1000 or 1,000 or 1,000,000 but not something that is not numberic....
7
by: hazz | last post by:
yes i should know this but ... V,-1,1,2,-1,333,5 I would like to return the value from any position within the comma delimited string position 1 is "v" position 2 is "-1" position 6 is...
15
by: staeri | last post by:
I'm looping through some textboxes to sum the values. If the value in the textbox has a dot or a space as thousand separator the sum function doesn't work. Can someone help me to make it work...
10
by: klineb | last post by:
Good Day, I have written and utility to convert our DOS COBOL data files to a SQL Server database. Part of the process requires parsing each line into a sql statement and validting the data to...
3
by: staeri | last post by:
If trying to format a value in a GridView with the following function to be shown with thousand separators. If no value exists it should show 0. If I send the value = 45000 it is still shown as...
4
by: toffee | last post by:
Hi all, I created a little button which when clicked will run a query on mysql db and output the results as an excel spreadsheet. I do this by setting the header as application excel. All works...
2
by: paolo | last post by:
Thanks in advance to everyone that will give me help for these questions. The function formatCurrency is used to auto-format a numeric value with thousands separators and a decimal separator. ...
1
by: (2b|!2b)==? | last post by:
I have the following line in my code, which is supposed to skip commas and white space and to read a comma seperated value string into the appropriate variables: sscanf(temp.c_str(),...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.