String code = new String("abc123号");
code=code.replace("号", "");
Pattern pattern = Pattern.compile("\\d+$");
Matcher matcher = pattern.matcher(code);
if(matcher.find()){
int num=Integer.parseInt(matcher.group());
num++;
code=code.substring(0,code.length()-matcher.group().length());
code=code+num;
}else{
System.out.println("字符串code不是以数字结尾的");
}
}