different formatting for EURO in JODA and JAVA

234 Views Asked by At

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?

0

There are 0 best solutions below