-1
我收到数字格式异常错误..要比较存储在数据库中的值作为字符串值。下面代码中“百分比”的值将是+ 10.05%或-10.05%,“ percentabove”值会像11.05和‘percentbelow’值是10.00 ..数字格式异常错误
代码:
percentabove = cursor.getString(cursor.getColumnIndex(DBConstants.PERCENTABOVE));
percentbelow = cursor.getString(cursor.getColumnIndex(DBConstants.PERCENTBELOW));
}while(cursor.moveToNext());
double newprice= Double.parseDouble(percent);
double maxprice = Double.parseDouble(percentabove);
double minprice = Double.parseDouble(percentbelow);
if(newprice>maxprice || newprice<minprice)
{
String status="";
if(newprice>maxprice)
{
status="Up";
}
else if(newprice<minprice)
{
status="Down";
}
有format..Can我们使用的DecimalFormat任何建议更改格式双到其他数据类型?
你检查你有什么与此? double newprice = Double.parseDouble(percent); – 2013-03-02 08:08:53
请编辑你的问题与你正在绑定解析的字符串的真实例子。 – Simon 2013-03-02 08:32:35