Multi-currency support in Java

Last updated 1 year ago by Romain Guefveneu



First thing first, how to format a currency? The position of the currency symbol doesn’t depend on the currency itself, but on the country of the locale.

Input field

Building our own currency input field is not very complicated. The main issue to solve is to know where to draw the currency symbol. Indeed, depending on the currency format, we have seen that the symbol can be either before the value or after the value. As we certainly don’t want to parse the format pattern, these four DecimalFormat methods will be useful:

  • getNegativePrefix()
  • getPositivePrefix()
  • getNegativeSuffix()
  • getPositiveSuffix()
Read full Article