469,914 Members | 2,127 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,914 developers. It's quick & easy.

Convert a currency string to a double

Hi All,

I'm am looking to convert a currency string (e.g. "$1,234.56" to a
double value).

It appears this will work:

double val = Convert.ToDouble(Double.Parse*("$123,456.78901",

My question is, why doesn't this appear to work (which was my inital
attempt at solving this problem):

double iPurchasePrice = Convert.ToDouble(PurchasePrice,

It results in the exception:

System.FormatException: Input string was not in a correct format.

It appears to be choking on the "$" symbol. When I remove that it
works. I tried creating my own NumberFormatInfo supplying all of the
Currency related properties including CurrencySymbol, but it still
appears to have problems with the "$" sign.

Anyone know why this might be? Again, the Parse method works fine, I'm
just more curious if anyone had any further insight.


Nov 17 '05 #1
0 7841

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark | last post: by
2 posts views Thread by jiangyh | last post: by
1 post views Thread by ACaunter | last post: by
1 post views Thread by joe | last post: by
5 posts views Thread by Eric | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.