Solved

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

Posted on 2007-12-06
1
1,256 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Icons and Colors for Terms 3 32
Interview questions for support of a legacy ASP.NET site 4 58
C# HTTP GET method sample code 3 57
Web Form VB.Net  import CSV 4 36
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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