STRING::FORMAT_MONEY 1g 2023-11-28 laplante@plcb.ca GOWEB/STRING — Format Numbers as Currency Strings


title: “STRING::FORMAT_MONEY” version: “1.0.0” date: 2023-11-28 author: “laplante@plcb.ca” section: “1g” category: “GOWEB/STRING”


Name

string::format_money Format Numbers as Currency Strings

Synopsis

string::format_money(expression [, error: bool, position: "after|before", precision: int, symbol: string, lg: "fr", thousand: string, decimal: string])
format_money(expression [, ...])
string::formatMoney(expression [, error: bool, position: "after|before", precision: int, symbol: string, lg: "fr", thousand: string, decimal: string])
formatMoney(expression [, ...])

Description

The format_money function returns a number formatted as a currency string with customizable precision, thousand separators, decimal separators, currency symbols, and symbol placement.

When lg is set to "fr", French-style formatting rules are automatically applied.


Parameters


Examples

res={{
    format_money(134567.67); "\n";
    format_money(decimal:",", 134567.67); "\n";
    format_money(thousand:"#", decimal:",", 134567.67); "\n";
    format_money(precision:1, thousand:"#", decimal:",", 134567.67); "\n";
    format_money(symbol:"£ ", precision:1, thousand:"#", decimal:",", 134567.67); "\n";
    format_money(lg:"fr", 134567.67); "\n";
    format_money(lg:"fr", 134567.67, -123456.789); "\n";
    format_money(position:"after", symbol:"£ ", precision:1, thousand:"#", decimal:",", 134567.67); "\n";
    format_money(position:"before", symbol:"£ ", precision:1, thousand:"#", decimal:",", 134567.67); "\n";
}};

Returns:

$134,567.67
$134,567,67
$134#567,67
$134#567,7
£ 134#567,7
134 567,67 $
["134 567,67 $","-123 456,79 $"]
134#567,7£
£ 134#567,7

Author


See Also


Version History