Name

LSIsNumeric

Synopsis

LSIsNumeric(string)

Functions identically to the IsNumeric( ) function within the context of the current locale. Returns True if string can be converted to a number in the current locale or False if it can’t. Here’s an example that determines whether the supplied values are valid numbers for each locale:

<CFLOOP INDEX="locale" LIST="#Server.Coldfusion.SupportedLocales#">
  <CFSET temp = SetLocale(locale)>
  <CFOUTPUT>
    <P><B>#locale#</B><BR>
    -1: #LSIsNumeric(-1)#<BR>
    0: #LSIsNumeric(0)#<BR>
    1234: #LSIsNumeric(1234)#<BR>
    1,234,567,890: #LSIsNumeric('1,234,567,890')#<BR>
    $1234.99: #LSIsNumeric('$1234.99')#<BR>
    08/15/1999: #LSIsNumeric('08/15/1999')#<BR>
    7pm: #LSIsNumeric('7pm')#<BR>
    abcdef: #LSIsNumeric('abcdef')#<BR>
    true: #LSIsNumeric(true)#<BR>
    false: #LSIsNumeric(false)#<BR>
    yes: #LSIsNumeric('yes')#<BR>
    no: #LSIsNumeric('no')#<BR>
  </CFOUTPUT>
</CFLOOP>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.