1

The below code (which is in JODA) prints: €12,23

String formatAmount = new MoneyFormatterBuilder().
               appendCurrencySymbolLocalized().
               appendAmountLocalized().
               toFormatter().
               withLocale(new Locale("es", "ES")).
               print(Money.of(CurrencyUnit.EUR, 12.23));

System.out.print(formatAmount);

The below code prints: 12,23 €

String formatAmount = NumberFormat.
             getCurrencyInstance(new Locale("es", "ES")).
             format(amount);

System.out.print(formatAmount);

Can someone tell me which one is correct and why both the libraries print differently?

JasonBlacket
  • 67
  • 1
  • 6
  • It's just a matter of format, there are no correct or incorrect ways. Just Joda and Java decided to do it differently. – dabadaba Jul 01 '16 at 08:29
  • @dabadaba But in spanish locale the correct way of formatting the currency is 12,23 € , correct? – JasonBlacket Jul 02 '16 at 19:26

0 Answers0