0
正在尝试使用的NumberFormat删除货币字符()
import java.text.NumberFormat;
BigDecimal currencyAmount = new BigDecimal(9876543.21)
def currentLocale = Locale.US
def currencyFormatter = NumberFormat.getCurrencyInstance(currentLocale);
println "formatted currency = "+currencyFormatter.format(currencyAmount)
这将打印$9,876,543.21
格式化货币,之后除去货币角色,但我不想$或格式的货币的任何货币字符。无论如何去做?
这不适用于整数:'5280'将是'5,280'而不是'5,280.00',这正是我们想要的。 – Madbreaks