大家帮看看这是个什么问题?
代码:
public Map CostDetail(String id){
Map costmap = new HashMap();
int realhardware =0;
int realsoftware =0;
int realman =0;
int realadvisor =0;
int realother =0;
int curmanbud=0;
int curhardbud=0;
int cursoftbud=0;
int curadvisorbud=0;
int curotherbud=0;
int allrealcost =0;
int allbudcost = 0;
List list = realcoster.load(id);
System.out.println( "list=== "+list);
for (int i=0 ;i <list.size();i++){
Map map= (Map)list.get(i);
System.out.println( "map======= "+map);
realhardware = Integer.parseInt((String)map.get ( "realhardware "))+realhardware; --------------1003行
realsoftware = Integer.parseInt((String)map.get( "realsoftware "))+realsoftware;
realman = Integer.parseInt((String)map.get( "realman "))+realman;
realadvisor = Integer.parseInt((String)map.get( "realadvisor "))+realadvisor;
realother = Integer.parseInt((String)map.get( "realother "))+realother;
curmanbud = Integer.parseInt((String)map.get( "curmanbud "))+curmanbud;
curhardbud = Integer.parseInt((String)map.get( "curhardbud "))+curhardbud;
cursoftbud = Integer.parseInt((String)map.get( "cursoftbud "))+cursoftbud;
curadvisorbud = Integer.parseInt((String)map.get( "curadvisorbud "))+curadvisorbud;
curotherbud = Integer.parseInt((String)map.get( "curotherbud "))+curotherbud;
}
报错:
For input string: "0.13 "
详细内容
java.lang.NumberFormatException: For input string: "0.13 " at java.lang.
NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:456) at java.lang.Integer.parseInt(Integer.java:497) at org.zdtel.pm.project.watch.project_status.dao.jdbc.ProjectStatusJdbcDao.CostDetail(ProjectStatusJdbcDao.java:1003) at org.zdtel.pm.project.watch.project_status.dao.jdbc.ProjectStatusJdbcDao.DistanceDetail(ProjectStatusJdbcDao.java:908) at
这是数据转换出错吗?
------解决方案--------------------你要把 "0.13 " 转化成整数 所以就报错了
Integer.parseInt( "0.13 ");