I am reading a percentage value
from an excel
file, and I need this value to be of type double
.
I am using xlWorkSheet.get_Range("A1", "A1")Value2
to retrieve the value. Casting / converting to a double isn't working.
How can I convert this percentage
to a double
?
If your input is 87.5%, you'll need to get rid of the % sign first:
var inputText = "87.5%";
var doubleValue = Double.Parse(inputText.Replace("%", ""));
精彩评论