IsNumeric

Returns TRUE if string can be converted to a number; otherwise, FALSE.

See also IsBoolean.

Syntax

IsNumeric(string)
string

Any string value.

Examples

<!--- This example shows the use of IsNumeric --->
<HTML>
<HEAD>
<TITLE>
IsNumeric Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>IsNumeric Example</H3>

<CFIF IsDefined("FORM.theTestValue")>
    <CFIF IsNumeric(FORM.theTestValue)>
    <H3>The string <CFOUTPUT>#FORM.theTestValue#</CFOUTPUT> 
      can be converted to a number</H3>
    <CFELSE>
    <H3>The string <CFOUTPUT>#FORM.theTestValue#</CFOUTPUT> 
      cannot be converted to a number</H3>
    </CFIF>
</CFIF>

<FORM ACTION="isNumeric.cfm" METHOD="POST">
<P>Enter a string, and discover if
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>

</BODY>
</HTML>