81,092
社区成员
发帖
与我相关
我的任务
分享
String [][]str=new String[iRowCount][iColCount];
for (int i=1;i<iRowCount;i++) {
HSSFRow row=sheet.getRow(i);
if(sheet.getRow(i)!=null){
for(int j=0;j<iColCount;j++) {
HSSFCell cell =row.getCell(j);
if (cell!=null){
switch(cell.getCellType()) //判断类型
{
case HSSFCell.CELL_TYPE_NUMERIC: //数字
cell_value=((Double)cell.getNumericCellValue()).toString().trim();
//cell_value=cell_value.substring(0,cell_value.length());
System.out.println("xxxxxxxx长度"+cell_value.length());
System.out.println("xxxxxxxx长度"+cell_value);
break;
case HSSFCell.CELL_TYPE_STRING: //字符串
cell_value=cell.getStringCellValue().toString().trim();
//cell_value = new String(cell_value.getBytes(), "utf-8");
//cell_value=encodeURI(cell_value);
break;
case HSSFCell.CELL_TYPE_FORMULA: //公式
cell_value= cell.getCellFormula().toString().trim();
break;
case HSSFCell.CELL_TYPE_BLANK: // 空值
cell_value= " <font color=red> null </font> ";
break;
case HSSFCell.CELL_TYPE_ERROR: // 故障
break;
default: //未知类型
cell_value= " <font color=red> null </font> ";
break;
} //end switch]);
out.print(cell_value+ " ");
//str[i][j]=cell_value=cell_value.substring(0,cell_value.length()-1);
str[i][j]=cell_value.replace((char)12288,' ').replace(" ","");
//str[i][j]=cell_value.replace(" ","").trim();
System.out.println("第"+i+"行,第"+j+"列 :"+ str[i][j]);
} //end if
} //end for (short j = 0; j < iColCount; j++) {
// out.print( " <br> ");
} //end if(sheet.getRow(i)==null){
else
{
iRowCount++;
System.out.println("fileToBeRead " + iRowCount);
}
String str="生存退保 ";
String str1="生存退保";
byte[] buff=str.getBytes();
int strnum=buff.length;
System.out.println(strnum);
byte[] buff1=str1.getBytes();
int strnum1=buff1.length;
System.out.println(strnum1);
str=str.replace(" ","");
str=str.replace('\t',' ');
str=str.trim();
//str=vacM.trimtest(str);
String insertSQL="insert into import (one) values ('"+str+ "')";
System.out.println("xxxxxxx"+insertSQL);
String str="生存退保 ";
str=str.trim();
str=str.replace(" ","");
str=str.replaceAll("\\s*", "");
str=str.replace("\\s+", "");
String insertSQL="insert into import (one) values ('"+str+ "')";
System.out.println("xxxxxxx"+insertSQL);
String str="生存退保 ";
String str1="haha ";
str=str.trim();
str1=str1.trim();
str=str.replace(" ","");
str=str.replaceAll("\\s*", "");
String insertSQL="insert into import (one) values ('"+str+ "')";
String insertSQL1="insert into import (one) values ('"+str1+ "')";
System.out.println("xxxxxxx"+insertSQL);
System.out.println("xxxxxxx"+insertSQL1);