问题描述
我在解析字符串时遇到问题(来自平面文本输入文件)
加倍。
代码:
currentImportDetail.Result = CType(line.Substring(7,8).Trim(""),
System.Double)
我手表中的内容:
line.Substring(7,8).Trim("")" 0.006000" ;
CType(line.Substring(7,8).Trim("),System.Double)6000.0
System.Decimal.Parse(line.Substring (7,8).Trim(""))6000D
cDec(line.Substring(7,8).Trim(""))6000D
cdbl(line.Substring(7,8).Trim(""))6000.0
我试图使用其他解析方法但由于未知原因结果
是假的,我不知道为什么。
我的区域设置目前是荷兰语(比利时),但是因为他解析了
字符串到6000点0而不是逗号,我怀疑区域设置是
之所以没有像我想要的那样解析我的数据。
Hi,
I''m having a problem parsing strings (comming from a flat text input file)
to doubles.
the code:
currentImportDetail.Result = CType(line.Substring(7, 8).Trim(" "),
System.Double)
What is in my Watch:
line.Substring(7, 8).Trim(" ") "0.006000"
CType(line.Substring(7, 8).Trim(" "), System.Double) 6000.0
System.Decimal.Parse(line.Substring(7, 8).Trim(" ")) 6000D
cDec(line.Substring(7, 8).Trim(" ")) 6000D
cdbl(line.Substring(7, 8).Trim(" ")) 6000.0
I tried to use the other parse methods but for an unknown reason the result
is false and I don''t know why.
My regional settings are currently Dutch(Belgium), but since he parses the
string to 6000 point 0 and not comma, I doubt that the regional settings are
the reason why it isn''t parsing my data like I want.
推荐答案
这篇关于在vb.NET中解析双精度数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!