我今天早上在VB6应用程序中遇到了一个奇怪的错误,这都是因为IsNumeric没有像我预期的那样工作.有人可以解释为什么?对我来说,这似乎是一个错误.
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文档:
原文链接:https://www.f2er.com/vb/255580.htmlNote 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.