
正文
POI取消科学计数法
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
前台输入手机号13777777777,如果是为Double类型接收,就会自动转为科学计数法
找了下,一般是Double转String,方法一般有两种:
1.利用String.format()saleUnilateImport.setPhone(String.format("%.4f",row.getCell(1).getNumericCellValue()));//15145117218.0000保留4位小数String.format("%.0f", row.getCell(0).getNumericCellValue())//15145117218,取整!2.利用DecimalFormat类DecimalFormat df = new DecimalFormat("#");//转换成整型saleUnilateImport.setPhone(df.format(row.getCell(1).getNumericCellValue()));3.利用DecimalFormat类DecimalFormat df = new DecimalFormat("#,##0.00");//保留两位小数且不用科学计数法saleUnilateImport.setPhone(df.format(row.getCell(1).getNumericCellValue()));
转自:http://free9277.blog.163.com/blog/static/11641721220111127111239951/





