Is there a way to get a text description of the currency represented by a Currency object in Java?
i.e. I have AZM, I want Azerbaijan Manat
Is there a way to get a text description of the currency represented by a Currency object in Java?
i.e. I have AZM, I want Azerbaijan Manat
Not in the standard API. The data behind the Currency class is loaded from the package-private class java.util.CurrencyData
, and there's simply no text description present there. You can look at it if you have the source code installed with your JDK.
You will have to set up your own mapping. Google or Stackoverflow questions will point to the ISO site
However you'll have to scrape the page as there seems to be no XML or text file as there is for country
It's not supported by Java but a few libraries can do this.
My number one choice would be ICU,
This call can get you the name of a currency in multiple locales. ICU also supports all other i18n features not available in JRE. However, it's pretty big.
Another option is jPOS,
If you do anything with financial data, this is the de-facto standards. Watch for its license. Our lawyers didn't like it for some reason.