De-Format Currency in C#

Posted by hpatel298 on Stack Overflow See other posts from Stack Overflow or by hpatel298
Published on 2010-03-08T20:19:01Z Indexed on 2010/03/08 20:21 UTC
Read the original article Hit count: 262

Filed under:

I have a string value coming from a label in the .aspx page as following.

string text = Price.Text; // Price.Text = "$31.07"
Single value = Convert.ToSingle(text); //throws FormatException

I can replace the $ sign with the empty text and then Convert to Single but I was wondering if there is better way to de-format the text with the '$' sign into a Single.

© Stack Overflow or respective owner

Related posts about c#