lSIsNumeric

Description

Determines whether a string is a valid representation of a number in the current locale.

Categories

Related

History

ColdFusion 8: Added the locale parameter. ColdFusion MX: Changed formatting behavior: this function might return a different result than in earlier releases. This function uses Java standard locale formatting rules on all platforms.

Syntax

LSIsNumeric(string [, locale])

Attributes

AttributeDescriptionRequiredDefault
localeLocale to use instead of the locale of the page when processing the function
stringA string or a variable that contains one

Returns

True, if the string represents a number the current locale; False, otherwise.

Usage

To set the default display format of date, time, number, and currency values, use the SetLocale function.

Example

<h3>LSIsNumeric Example</h3> 
 
<cfif IsDefined("FORM.locale")> 
<!--- if locale is defined, set locale to that entry ---> 
<cfset NewLocale = SetLocale(FORM.locale)> 
 
Is the value "<cfoutput>#FORM.myValue#</cFOUTPUT>" 
a proper numeric value for <cfoutput>#GetLocale()#</cfoutput>? 
 
Answer: <cfoutput>#LSIsNumeric(FORM.myValue)#</cfoutput> 
</cfif> 
 
<form action = "LSIsNumeric.cfm"> 
 
Select a locale for which to check a numeric value: 
...