编码Code

补遗书编码是由招标文件编码递增

List<TenderBys> listBys = BysDao.selectList(new QueryWrapper<TenderBys>().eq("Sszbwjid", id).orderByDesc("BYSCODE")); String byscode =listBys.get(0).getByscode();//获取补遗书最大编码 E1300000870000270001001Z09
String head = byscode.substring(0,zfilecode.length()-2);//E1300000870000270001001Z
String last = byscode.substring(byscode.length()-2);//09
String final = head+String.format("%02d",(Integer.valueOf(last)+1));

 

Java数字格式化输出时前面补0

int youNumber = 1;

// 0 代表前面补充0

// 4 代表长度为4

// d 代表参数为正数型

String str = String.format("%04d", youNumber);

System.out.println(str); // 0001

Java去掉数字字符串开头的0三种方法

方式一:

例如:”0000123” (字符串必须全为数字)
处理过程:
String tempStr = “0000123”;
int result = Integer.parseInt(tempStr);

方式二:

例如:”0000123” (字符串必须全为数字)
处理过程:
String str = “0000123”;
String newStr = str.replaceFirst("^0*", “”);
System.out.println(newStr);

方式三:

例如:”0000123” (字符串必须全为数字)
处理过程:
String str = “0000123”;
String newStr = str.replaceAll("^(0+)", “”);
System.out.println(newStr);




原文地址:https://www.cnblogs.com/Esther-yan/p/14159574.html