java生成“001“.“002“.“099“....编号

/**
 * 不够位数的在前面补0,
 *
 * @param code
 * @param num  保留num的长度位数字
 * @return
 */
private String autoGenericCode(String code, int num) {
	String result = "";
	// 保留num的位数
	// 0 代表前面补充0
	// num 代表长度为4
	// d 代表参数为正数型
	result = String.format("%0" + num + "d", Integer.parseInt(code) + 1);
	return result;
}

猜你喜欢

转载自blog.csdn.net/qq_43473129/article/details/120566750
099