Documentation

GetFormatDescription

array
CCurrencyLang::GetCurrencyFormat(
string currency
);

The method allows to get currency format on the current language for price formatting.

Checks availability of the necessary keys. When some keys are missing, installs their values by default.

Checks, in which section of site the method is called. When the method is called in the Bitrix24 or Bitrix24 On-premise administrative section, the currency format is converted to HTML-safe format (html tags and java scripts are removed).

Parameters

Parameter Description
currency Currency code which language-depended parameters are needed.

Returned values

Associative array with keys:

Key Description
FORMAT_STRING Currency ID code which language-dependent parameters are needed.
DEC_POINT Decimal point character when displaying amounts.
THOUSANDS_SEP Thousand separator.
THOUSANDS_VARIANT Preconfigured thousand separator or an attribute defining customized separator.
DECIMALS Number of displayed decimal places.
HIDE_ZERO (Y|N) specifies to hide or show nonsignificant zeros in decimal part (the result will be visible only in public part).

Examples

\Bitrix\Main\Loader::includeModule('currency');
$format = \CCurrencyLang::GetFormatDescription('RUB');
$value = 121.15;
$result = \CCurrencyLang::formatValue($value, $format);



© «Bitrix24», 2001-2024
Up