I have a string like "1.5%" and want to convert it to double value.
It can be done simple with following:
public static double FromPercentageString(this string value)
{
return double.Parse(value.SubString(0, value.Length - 1)) / 100;
}
but I don't want to use this parsing approach.
Is any other approach with IFormatProvider or something like this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…