IsNumeric
From Xojo Documentation
Method
Indicates whether the value passed is numeric.
Syntax
result=IsNumeric(arg)
Part | Type | Description |
---|---|---|
result | Boolean | True if arg is numeric; False otherwise. |
arg | Variable, value, or object whose data type is being investigated. |
Notes
A common usage of IsNumeric is to determine whether a user entered a string that can be converted to a number.
Strings greater than 127 characters always return False.
Examples
If the value passed to IsNumeric is a String that contains the string version of a number, then IsNumeric returns True. For example this code returns True:
This code returns False:
Check a user-entered string:
Var value As Double
Var b As Boolean
b = IsNumeric(TextField1.Value)
If b Then
value = TextField1.Value.ToDouble
End If
Var b As Boolean
b = IsNumeric(TextField1.Value)
If b Then
value = TextField1.Value.ToDouble
End If
See Also
Boolean, Byte, Color, Currency, Double, Int8, Int16, Int32, Int64, Single, String, UInt8, UInt16, UInt32, UInt64, Variant data types.