2021-11-23 java org.apache.commons.lang3.StringUtils 数值型字符串 添加前导零 去前导零

import org.apache.commons.lang3.StringUtils;
public static void main(String[] args) {

    String str = StringUtils.leftPad("1234",5,"0");
    System.out.println(str);
    str = StringUtils.leftPad("12345",5,"0");
    System.out.println(str);
    str = StringUtils.stripStart("000245","0");
    System.out.println(str);

}
image.png

你可能感兴趣的:(2021-11-23 java org.apache.commons.lang3.StringUtils 数值型字符串 添加前导零 去前导零)