MotoMusher Active Member Licensed User Longtime User Aug 1, 2013 #1 Can someone try this and confirm? I have it in a button event for testing. This says it is a number: Code: Copy Dim z As String = "SHE7150" If IsNumber(z) = True Then Msgbox("IsNumber", "") Else Msgbox("Not a Number", "") End If This correctly says it is not a number, along with nearly every other combination I try: Code: Copy Dim z As String = "SHZ7150" If IsNumber(z) = True Then Msgbox("IsNumber", "") Else Msgbox("Not a Number", "") End If I am running through a cursor and it keeps bombing on the first value above because it thinks it's a number...
Can someone try this and confirm? I have it in a button event for testing. This says it is a number: Code: Copy Dim z As String = "SHE7150" If IsNumber(z) = True Then Msgbox("IsNumber", "") Else Msgbox("Not a Number", "") End If This correctly says it is not a number, along with nearly every other combination I try: Code: Copy Dim z As String = "SHZ7150" If IsNumber(z) = True Then Msgbox("IsNumber", "") Else Msgbox("Not a Number", "") End If I am running through a cursor and it keeps bombing on the first value above because it thinks it's a number...
NJDude Expert Licensed User Longtime User Aug 1, 2013 #2 It seems it gets confused with an HEX number or something when having an "E", the resulting value is always 7FFFFFFF. If you do this you will see: Code: Copy ... Dim z AsString = "HE5001" ... Msgbox("IsNumber " & Bit.ToHexString(z).ToUpperCase, "") Among other values. I don't know, just guessing. Upvote 0
It seems it gets confused with an HEX number or something when having an "E", the resulting value is always 7FFFFFFF. If you do this you will see: Code: Copy ... Dim z AsString = "HE5001" ... Msgbox("IsNumber " & Bit.ToHexString(z).ToUpperCase, "") Among other values. I don't know, just guessing.
Erel B4X founder Staff member Licensed User Longtime User Aug 1, 2013 #3 It seems like a bug in the Android VM. The 'e' character causes the parser to treat the value as if it is written in exponent notation. You can use this workaround: Code: Copy Sub IsNumber2(s As String) As Boolean If IsNumber(s) Then Dim d As Double = s Return d <> d + 1 Else Return False End If End Sub Upvote 0
It seems like a bug in the Android VM. The 'e' character causes the parser to treat the value as if it is written in exponent notation. You can use this workaround: Code: Copy Sub IsNumber2(s As String) As Boolean If IsNumber(s) Then Dim d As Double = s Return d <> d + 1 Else Return False End If End Sub