isNumeric
Description
Determines whether a string can be converted to a numeric value. Supports numbers in U.S. number format. For other number support, use LSIsNumeric.
Categories
Related
Syntax
IsNumeric(string)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| string | A string or a variable that contains one. |
Returns
True,
if string can be converted to a number; False, otherwise.
Example
<h3>IsNumeric Example</h3>
<cfif IsDefined("FORM.theTestValue")>
<cfif IsNumeric(FORM.theTestValue)>
<h3>The string <cfoutput>#DE(FORM.theTestValue)#</cfoutput> can be
converted to a number</h3>
<cfelse>
<h3>The string <cfoutput>#DE(FORM.theTestValue)#</cfoutput> cannot be
converted to a number</h3>
</cfif>
</cfif>
<form action = "isNumeric.cfm">
Enter a string, and find out whether it can be evaluated to a numeric value.
<input type = "Text" name = "TheTestValue" value = "123">
<input type = "Submit" value = "Is it a Number?" name = "">
</form>