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.

Returns

True, if string can be converted to a number; False, otherwise.

Category

Decision functions

Function syntax

IsNumeric(string)

See also

IsBinary, IsValid

Parameters

Parameter Description

string

A string or a variable that contains one.

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"> <p>Enter a string, and find out whether it can be evaluated to a numeric value. <p><input type = "Text" name = "TheTestValue" value = "123"> <input type = "Submit" value = "Is it a Number?" name = ""> </form>

View comments in LiveDocs