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); 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM