Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String str = "Some3people6love20code102";
- String newstr = "";
- String tmp = "";
- for (int i = 0; i<str.length(); i++){
- if((int)str.charAt(i) >= 48 && (int)str.charAt(i) <= 57){
- tmp += str.charAt(i);
- }else{
- if(tmp.length()>0){
- newstr+=((Integer.parseInt(tmp)+50)+"");
- }
- newstr+=str.charAt(i);
- tmp = "";
- }
- System.out.println(newstr);
- }
- if(tmp.length()>0){
- newstr+=((Integer.parseInt(tmp)+50)+"");
- }
- System.out.println(newstr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement