Groovy web console

subscribe to the feed Subscribe
to this
site

currency formatting

Published 1 month ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
locale = new Locale("en","GB")
currency = Currency.getInstance("EUR")
formatter = java.text.NumberFormat.getCurrencyInstance(locale)
formatter.setCurrency(currency)
println(formatter.format(45.5))