Solved

How do I convert a string with commas into a double?

Posted on 2007-12-06
1
1,254 Views
Last Modified: 2013-12-16
I have a number that I am reading from a file.  It is saved with comma formatting, i.e., 2,000,000.00 etc.  When I try to use Double.Parse(valToConvert) it gives me an exception.  Is there a way without writing code to extract out the pure number to convert this?

Thanks

Note to Experts Exchange - the selecting of the time zone feature is aweful!  I can't find eastern standard time.
0
Comment
Question by:techhound
1 Comment
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 20422508
use:
double val = double.Parse(valToConvert.Replace(",",""));
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now