Convert Percentage String to Double

2011-07-05


If you have a percentage string and you want to convert it to a number type, like double. Here we have a sample:

string numString = myTextBox.Text.Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.PercentSymbol, "");
float fv = (float)(System.Convert.ToDouble(numString) / 100);