我试图将双值格式化为货币,然后删除欧元符号但我的应用程序崩溃。有人能告诉我哪里错了吗?将双倍转换为字符串并删除欧元符号货币
public class Formatting {
public static String replaceString(String text){
NumberFormat formatter = NumberFormat.getCurrencyInstance();
String moneyString = formatter.format(text);
System.out.println("epargne: "+moneyString);
return text.replaceAll("£", "");
}
public static String convert(double x){
return replaceString(Double.toString(x));
}
}
我人称其为类如下ý
双X = A + B + C;
System.out.println(Formatting.convert(x));
什么是例外? – PermGenError
假设我有1000.009我将它转换为1,000.01而没有前面的货币符号 – Dimitri
您的代码使用英镑“英镑”,而不是“欧元”。那是你的意图吗? – rossum