如何将此字符串8.12345678E-04解析为数字? [英] How to parse this string 8.12345678E-04 into a number?
本文介绍了如何将此字符串8.12345678E-04解析为数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我正在使用vb2010.
尝试将此字符串8.29933968E-04解析为一个数字,以便可以在电子表格中进行绘制.
如果此数字类似于1283912839E-5(即整数"&(E-xxx),但数字中没有小数点),则可以使用
字符串x ="1283912839E-5"
十进制dec = Decimal.Parse(x,NumberStyles.AllowExponent)
但这对我的电话号码无效.
我该怎么用?
Thx
Hi folks, I''m using vb2010.
Trying to parse this string 8.29933968E-04 into a number so I can plot in on a spreadsheet.
if this number were like 1283912839E-5(that is, ''integer''&(E-xxx) , without the decimal point in the number ) , then I could''ve used
string x = "1283912839E-5"
decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent )
but this does not work for my number.
What should I use?
Thx
推荐答案
尝试:
string s = " 8.29933968E-04";
decimal d = decimal.Parse(s, System.Globalization.NumberStyles.Float);
您的字符串"不是有效的指数.它缺少小数点.
Your "string" is not a valid exponent. It''s missing a decimal point.
这篇关于如何将此字符串8.12345678E-04解析为数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文