Bit in the ass by API 2

Was tracking down a bug in my app and couldnt figure out what was wrong initially.

All the code seemed right but setting a value to code like

value = string.ToInteger

seemed to be the culprit. Sure enough the string contained a value like 3.0e+2 (an integer expressed in exponential form) But the docs say



Returns the integer equivalent of the source string. This function is the same as the Val function but is international-savvy.

But experience was telling me this wasnt true

So a quick test in 2021r2.1 with

Dim s As String = "3.0e+2"

Dim i1 As Int32 = Val(s)
Dim i2 As Int32 = s.Val
Dim i3 As Int32 = s.ToInteger


shows that indeed i1 = 300, i2 = 300, and i3 is 3 not 300 like I would have expected. I changed my use of ToInteger to Val and things work as expected.

Be careful out there

EDIT : reported bug