String originalValue = "08-01";
String n1 = StringUtils.substringAfterLast(originalValue, "-");//截取最后-后面的数字
System.out.println("08-01截取后= "+n1);
int i = n1.length();
if ("".equals(n1)) {
n1 = "0";
}
//截取后的值+1
int nums = Integer.parseInt(n1) + 1;
System.out.println("n1+1后的值: "+nums);
//转字符串
String newNum = String.valueOf(nums);
i = Math.min(i, newNum.length());
String a = originalValue.subSequence(0, originalValue.length() - i) + newNum;
System.out.println("拼接后的值:"+a);
更多的字符串截取地址: