ecx:formatNumber
    • 1 Minute to read
    • Dark
      Light

    ecx:formatNumber

    • Dark
      Light

    Article summary

    The function ecx:formatNumber formats a number based on the specified variables. The value returned is a string data type.

    Examples

    Function

    Returns

    <%${ecx:formatNumber('1123.45', '', 'fr')}%>

    1 123,45

    <%${ecx:formatNumber('67890', '', 'aus')}%>

    67,890

    <%${ecx:formatNumber('11223344.55', '', 'aus')}%>

    11,223,344.55

    <%${ecx:formatNumber('100', '$#', '')}%>

    $100

    <%${ecx:formatNumber('50', '# €', '')}%>

    50 €

    <%${ecx:formatNumber('0.56', '#%', '')}%>

    56%

    <%${ecx:formatNumber('test', '#%', '')}%>

    test

    <%${ecx:formatNumber('100.01', '#,##0.00', '')}%>

    100,01

    Structure​

    ecx:formatNumber(string1, string2, string3)

    Parameters​

    Parameter

    Description

    string1

    The target value to format. If the target string is not a number, the string is returned unmodified.

    string2

    Symbol added before or after the number. Any character entered in this parameter is appended to the number based on its placement relative to the number sign (#), which represents the number itself.

    string3

    Variable localeCode. Applies a country-specific format to the number based on the ISO language code used. This parameter determines the characters used to separate thousands and decimal values.


    Was this article helpful?