}
String data ="xxdm-5-学校代码#sysbh-10-实验室编号#";
String str[] = data.split("#");
for (int i = 0; i < str.length; i++) {
String tem = str[i];
String col[] = tem.split("-");
System.out.println("//"+col[2]+"");
System.out.println("String "+col[0]+" = sheet.getCell("+i+", i).getContents();");
System.out.println("if (StringUtils.nullOrBlank("+col[0]+")) {");
System.out.println(" xxdm=\"\";");
System.out.println("} else {");
System.out.println(" if ("+col[0]+".length()>"+col[1]+") {");
System.out.println(" errormeg.append(\"第\" + (i + 1) + \"行->"+col[2]+"的长度超过设定长度"+col[1]+"\\r\\n\");");
System.out.println(" continue;");
System.out.println(" }else {");
System.out.println(" sj6.set"+col[0].substring(0, 1).toUpperCase() + col[0].substring(1) +"("+col[0]+");");//第一个字母大写
System.out.println(" }");
System.out.println("}");
}
循环判断代码输出
最新推荐文章于 2023-07-04 14:45:00 发布