2013-10-08 45 views
-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可以處理這個數字。

+0

嘗試使用DecimalFormat(「#,###。##」); –

回答

相關問題