Method

# IsNumeric

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Indicates whether the value passed is numeric.

## Usage

``` xojo
result = IsNumeric(value)
```

| Part   | Type                               | Description                                                                               |
|--------|------------------------------------|-------------------------------------------------------------------------------------------|
| result | `Boolean</api/data_types/boolean>` | `True</api/language/true>` if *value* is numeric; `False</api/language/false>` otherwise. |
| value  | `Variant</api/data_types/variant>` | Variable, value, or object whose data type is being investigated.                         |

## Notes

A common usage of <span class="title-ref">IsNumeric</span> is to determine whether a user entered a string that can be converted to a number.

Strings greater than 127 characters always return `False</api/language/false>`.

On Desktop and iOS targets, <span class="title-ref">IsNumeric</span> is locale-sensitive.

## Sample code

If the value passed to <span class="title-ref">IsNumeric</span> is a `String</api/data_types/string>` that contains the string version of a number, then <span class="title-ref">IsNumeric</span> returns `True</api/language/true>`. For example this code returns `True</api/language/true>`:

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

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This code returns `False</api/language/false>`:

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

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Check a user-entered string:

``` xojo
Var value As Double
Var b As Boolean
b = IsNumeric(TextField1.Text)
If b Then
  value = TextField1.Text.ToDouble
End If
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Boolean</api/data_types/boolean>`, `Byte</api/data_types/additional_types/byte>`, `Color</api/data_types/color>`, `Currency</api/data_types/currency>`, `Double</api/data_types/double>`, `Int8</api/data_types/additional_types/int8>`, `Int16</api/data_types/additional_types/int16>`, `Int32</api/data_types/additional_types/int32>`, `Int64</api/data_types/additional_types/int64>`, `Single</api/data_types/single>`, `String</api/data_types/string>`, `UInt8</api/data_types/additional_types/uint8>`, `UInt16</api/data_types/additional_types/uint16>`, `UInt32</api/data_types/additional_types/uint32>`, `UInt64</api/data_types/additional_types/uint64>`, `Variant</api/data_types/variant>` data types.

</div>
