Flex Number Format

11,809

Solution 1

Use the numberformatter.

<mx:NumberFormatter id="myFormatter"
    decimalSeparatorFrom="."
    decimalSeparatorTo="."
    precision="-1"
    rounding="none"
    thousandsSeparatorFrom=","
    thousandsSeparatorTo=","
    useNegativeSign="true"
    useThousandsSeparator="true"/>

actionscript code

x = myFormatter.format(x);

Solution 2

I guess one need to build his/her own number formatter to do this task. Simply using the NumberFormatter will only result into following

123,456 and not 1,23,456 (i.e. the Indian style number formatting)
Share:
11,809
Srinivasan
Author by

Srinivasan

Java Developer

Updated on August 20, 2022

Comments

  • Srinivasan
    Srinivasan almost 2 years

    I want to format a number in indian format.

    for example,

    x= 123456 should be formatted as 1,23,456.

    How can i do it in flex?

    Thanks,