Using NumberFormatter !

This class is used to format the number in a way we like, like the number 2000 to 2,000 or 2000 to 2,00.00 or 2000.2345 to 2,000.23 like that.So the usage is given below, its like the beautification to the data.

Code Example:

<mx:NumberFormattter id=”nftr” precision=”2″ />

Now in a the Script block u can use this to format the number.As

nftr.format(2000.123456);

This will format to 2,000.12.

There are still many properties in the NumberFormatter class to use like thousandSeperatorfrom,thousandSeperatorto …… like so, can explore these very simple.

As i said it addds beautification to the data in the Application.

Enjoy the post.Can leave a comment for queries.

Advertisements

One Response to Using NumberFormatter !

  1. karteek kesav says:

    Hi i have one query
    In text input i have to enter only numbers and the first value should not be a ‘0’ value.
    correct format :-123,1209
    In correct format:-0123,012

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: