Home > DeveloperSection > Forums > How to parse the value to float?
lois waisbrooker
lois waisbrooker

Total Post:70

Points:494
Posted on    May-09-2013 4:55 AM

 C# C# 
Ratings:


 1 Reply(s)
 912  View(s)
Rate this:
Hi!

How to parse a value to float? When I try to parse that generate error as following

My line of code as following

float rt = float.Parse("12.50%");

Error message

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

Please resolve my problem. 

Thank in advance!


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    May-09-2013 8:08 AM

Hi Lois!

Try as following

float rt = float.Parse("12.50%".Replace("%",""));

Don't want to miss updates? Please click the below button!

Follow MindStick