-2
我:異常Java.lang.NumberFormatException
DecimalFormat mydf = new DecimalFormat("#,##0.00");
mydf.format(Double.parseDouble(item.getText(4)
.replaceAll(",", ""))
+ Double.parseDouble(item.getText(6)
.replaceAll(",", ""))
+ Double.parseDouble(item.getText(8)
.replaceAll(",", "")))
其中,項目」是一個表項,它返回字符串,我得到錯誤的時候,‘item.getText’對價'24,807,847.65' 。 我以爲Double可以處理這個數字。
嘗試使用DecimalFormat(「#,###。##」); –