|
Question : How do I convert a string with commas into a double?
|
|
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.
|
|
Answer : How do I convert a string with commas into a double?
|
|
use: double val = double.Parse(valToConvert.Replace(",",""));
|
|
|
|