我有這樣的代碼:數字格式()不給預期的結果
public double stringToDouble(String s) {
NumberFormat nf = NumberFormat.getInstance(Locale.getDefault());
try {
return nf.parse(s).doubleValue();
} catch (java.text.ParseException e) {
return 0.0;
}
}
其工作正常,但與像一些60.0值它給600.0,我不知道爲什麼,60它給60.0
有什麼建議嗎?在此先感謝