首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

转成integer以后运算仍然是字符串的拼接

2012-12-27 
转成integer之后运算仍然是字符串的拼接String codeareaBizImpl.getCodeById(Integer.parseInt(supid))I

转成integer之后运算仍然是字符串的拼接

String code=areaBizImpl.getCodeById(Integer.parseInt(supid));Integer codeint = Integer.parseInt(code);System.out.println(codeint+2222);if(param.equalsIgnoreCase("province")&&supid.equalsIgnoreCase("1")){System.out.println("province"+"---"+codeint+10000);}

?如果codeint 为100,那么结果为10010000。

?

?注意:字符串和整形的数字相加之后还是字符串。

?

?但是如果code=091100的话 转换成integer就会出现问题,结果为91100显然和我们想要的结果不符。

?

?

热点排行