java生成编号
原创
©著作权归作者所有:来自51CTO博客作者菜鸟__的原创作品,请联系作者获取转载授权,否则将追究法律责任
public static String getNewEquipmentNo(String equipmentType, String equipmentNo){
String newEquipmentNo = "00001";
if(equipmentNo != null && !equipmentNo.isEmpty()){
int newEquipment = Integer.parseInt(equipmentNo) + 1;
newEquipmentNo = String.format(equipmentType + "%05d", newEquipment);
}
return newEquipmentNo;
}
public static void main(String[] args) {
String equipmentNo = Test2.getNewEquipmentNo("csdn", "00001");
System.out.println("生成编号为:" + equipmentNo);
}