CurrencyFormat
No description available.
Method Signature
CurrencyFormat(number=[any], type=[string], locale=[string])
Arguments
Argument
Type
Required
Description
Default
number
any
true
type
string
false
local
locale
string
false
Examples
Tag Example
lsCurrencyFormat returns a currency value using the locale convention. Default value is local.
<!--- loop through list of locales; show currency values for 100,000 units --->
<bx:loop LIST="#Server.BOXLANG.SUPPORTEDLOCALES#" index="locale" delimiters=",">
<bx:set oldlocale = setLocale( locale ) >
<bx:output><p><b><I>#locale#</I></b>
Local: #lsCurrencyFormat( 100000, "local" )#
International: #lsCurrencyFormat( 100000, "international" )#
None: #lsCurrencyFormat( 100000, "none" )#
<hr noshade>
</bx:output>
</bx:loop>
Script Example using specific locale
lsCurrencyFormat returns a currency value using the specified locale.
writeDump( lsCurrencyFormat( 5, "local", "en_US" ) );
Additional Examples
amount = 100;
locale = "en_US";
writeoutput( LSCurrencyFormat( amount, "local", locale ) ); // $100.00
writeoutput( LSCurrencyFormat( amount, "international", locale ) ); // USD 100.00
writeoutput( LSCurrencyFormat( amount, "none", locale ) ); // 100.00
locale = "ja_JP";
writeoutput( LSCurrencyFormat( amount, "local", locale ) ); // ¥100
writeoutput( LSCurrencyFormat( amount, "international", locale ) ); // JPY 100
writeoutput( LSCurrencyFormat( amount, "none", locale ) );
// 100
Related
Last updated
Was this helpful?