IsNumeric

Description

Returns TRUE if string can be converted to a number; otherwise, FALSE. Supports numbers in U.S. number format. For international number support, use LSIsNumeric.

Category

Decision functions

Syntax

IsNumeric(string) 

See also

IsBinary

Parameters

Parameter
Description
string
A string value

Example

<!--- 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>#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" 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>