• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to get numeric value of a currency code?

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

In java 1.6, how can we get the numeric value of a currency code as per ISO 4217. (Eg. for INR numeric value is 356 )

Thanks in advance
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a java.util.Currency class. Unfortunately for you, it will only let you convert from the three letter code to the currency symbol, not the numeric code. It delegates most of its work to the class com.ibm.icu.util.Currency, but that also doesn't seem to have any interface to return the numeric code. Probably they didn't consider it to be a useful piece of information.

If you really need that conversion, you're probably stuck with downloading the ISO 4217 data, and writing your own converter. You might even try extending Currency to do it.
reply
    Bookmark Topic Watch Topic
  • New Topic