java 字符串中的数字加1的方法 如001 加1 计算方法

    DecimalFormat decimalFormat=new DecimalFormat("000");// 字符串数字的位数
    String code="aaa001"; // 字符串
    String codenew=code.substring(3, code.length()); // 截取字符中的数字
    int i=Integer.parseInt(codenew)+1;
    String k=decimalFormat.format(i);
    System.out.println(k); 

  

posted @ 2022-04-12 16:45  oO星芒蝶翼Oo  阅读(4405)  评论(0编辑  收藏  举报