开发者

C# Converting a Percentage Value read from Excel to a Double

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("%", ""));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜