//定义最大位数
private final Integer DIGIT_LENGTH = 5;
//格式化num
if (id.length() < DIGIT_LENGTH) {
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
nf.setMaximumIntegerDigits(DIGIT_LENGTH);
nf.setMinimumIntegerDigits(DIGIT_LENGTH);
id = nf.format(num);
}
最后修改于 2019-01-30 09:45:32
如果觉得我的文章对你有用,请随意赞赏
扫一扫支付

