Internationalizing Currency (I18N with Currency)

As we have internationalize the date, time and numbers, we can internationalize the currency also. The currency differs from one country to another so we need to internationalize the currency.

The NumberFormat class provides methods to format the currency according to the locale. The getCurrencyInstance() method of the NumberFormat class returns the instance of the NumberFormat class.

The syntax of the getCurrencyInstance() method is given below:

Example of Internationalizing Currency

In this example, we are internationalizing the currency. The format method of the NumberFormat class formats the double value into the locale specific currency.

Output:£10,500.32 for the locale en_GB
       $10,500.32 for the locale en_US
       10 500,32 £ for the locale fr_FR







Latest Courses