IsNumeric

From Xojo Documentation

Revision as of 17:59, 20 July 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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:

Var b As Boolean
b = IsNumeric("3.1416")

This code returns False:

Var b As Boolean
b = IsNumeric("Hello")

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

See Also

Boolean, Byte, Color, Currency, Double, Int8, Int16, Int32, Int64, Single, String, UInt8, UInt16, UInt32, UInt64, Variant data types.