加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vb.net – 对于包含D字符的字符串,IsNumeric返回true

发布时间:2020-12-17 00:13:46 所属栏目:大数据 来源:网络整理
导读:我今天早上在VB6应用程序中遇到了一个奇怪的错误,这都是因为IsNumeric没有像我预期的那样工作.有人可以解释为什么?对我来说,这似乎是一个错误. 此代码在消息框中显示4.15877E 62: Dim strMessage As StringstrMessage = "0415877D57"If IsNumeric(strMessa
我今天早上在VB6应用程序中遇到了一个奇怪的错误,这都是因为IsNumeric没有像我预期的那样工作.有人可以解释为什么?对我来说,这似乎是一个错误.

此代码在消息框中显示4.15877E 62:

Dim strMessage As String
strMessage = "0415877D57"
If IsNumeric(strMessage) Then
    MsgBox CDbl(strMessage)
Else
    MsgBox "not numeric"
End If

我猜测运行时引擎错误地认为D实际上是E?
我认为这是一个错误,因为VB.NET中完全相同的代码输出不是数字
这是IsNumeric的已知问题吗?

如果您查看VB6文档:

Note Floating-point values can be expressed as mmmEeee or mmmDeee,in which mmm is the mantissa and eee is the exponent (a power of 10). The highest positive value of a Single data type is 3.402823E+38,or 3.4 times 10 to the 38th power; the highest positive value of a Double data type is 1.79769313486232D+308,or about 1.8 times 10 to the 308th power. Using D to separate the mantissa and exponent in a numeric literal causes the value to be treated as a Double data type. Likewise,using E in the same fashion treats the value as a Single data type.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读