Whatever message this page gives is out now! Go check it out!

LSParseNumber

Last update:
May 18, 2026

Description

Converts a string that is a valid numeric representation in the current locale into a formatted number.

Returns

A formatted number that matches the value of the string.

Category

Syntax

LSParseNumber(string [, locale])

See also

LSParseDateTimeSetLocaleLocales in the Developing ColdFusion Applications

History

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

Parameters

Parameter
Description
string
A string or a variable that contains one
locale
Locale to use instead of the locale of the page when processing the function

Usage

This function uses Java standard locale formatting rules on all platforms.To set the default display format of date, time, number, and currency values, use the SetLocale function.

Example

<h3>LSParseNumber Example</h3> 
<p>LSParseNumber converts a locale-specific string to a number. 
Returns the number matching the value of string. 
<!--- loop through a list of locales and show number values ---> 
<cfloop LIST = "#Server.Coldfusion.SupportedLocales#" 
index = "locale" delimiters = ","> 
<cfset oldlocale = SetLocale(locale)> 

<cfoutput><p><B><I>#locale#</I></B><br> 
#LSNumberFormat(-1234.5678, "


")#<br> 
#LSNumberFormat(-1234.5678, "


.
")#<br> 
#LSNumberFormat(1234.5678, "


")#<br> 
#LSNumberFormat(1234.5678, "


.
")#<br> 
#LSNumberFormat(1234.5678, "$_(


.
)")#<br> 
#LSNumberFormat(-1234.5678, "$_(


.
)")#<br> 
#LSNumberFormat(1234.5678, "+


.
")#<br> 
#LSNumberFormat(1234.5678, "-


.
")#<br> 
The actual number: 
#LSParseNumber(LSNumberFormat(1234.5678, "


"))#<br> 
<hr noshade> 
</cfoutput> 
</cfloop>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page