MitchBu Well-Known Member Licensed User Longtime User May 22, 2019 #1 I need to validate that the data entered is a number before storing it. I found this in the forum : Code: Copy Sub IsNan(d As Double) As Boolean Return d <> d End Sub Problem is, when I call it with this : Code: Copy Log("isnan: " & IsNan(EtRouting.Text)) ' contains "ƽƾƿǀ" I get this Java error : Error occurred on line: 286 (Main) java.lang.NumberFormatException: For input string: "ƽƾƿǀ" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:539) at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180) at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262) at com.bujardet.checkprinter.main._initedittexts(main.java:914) at com.bujardet.checkprinter.main._activity_create(main.java:612) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
I need to validate that the data entered is a number before storing it. I found this in the forum : Code: Copy Sub IsNan(d As Double) As Boolean Return d <> d End Sub Problem is, when I call it with this : Code: Copy Log("isnan: " & IsNan(EtRouting.Text)) ' contains "ƽƾƿǀ" I get this Java error : Error occurred on line: 286 (Main) java.lang.NumberFormatException: For input string: "ƽƾƿǀ" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) at java.lang.Double.parseDouble(Double.java:539) at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180) at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262) at com.bujardet.checkprinter.main._initedittexts(main.java:914) at com.bujardet.checkprinter.main._activity_create(main.java:612) at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
Erel B4X founder Staff member Licensed User Longtime User May 22, 2019 #2 Code: Copy If IsNumber(d) Then ... Upvote 0
S sorex Expert Licensed User Longtime User May 22, 2019 #3 what's wrong with the usual isNumber command? Upvote 0
MitchBu Well-Known Member Licensed User Longtime User May 22, 2019 #4 Thank you Erel and sorex. I searched for "NaN" in the forum, so I did not find isNumber. Sorry about that. Thank you Upvote 0
Thank you Erel and sorex. I searched for "NaN" in the forum, so I did not find isNumber. Sorry about that. Thank you