• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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: 3064
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic