Skip to content

Commit e1e1aac

Browse files
Update find_sum_from_string.java
1 parent 2fee86e commit e1e1aac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

solutions/string/find_sum_from_string.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ public static void main(String[] args) {
88
if(str.charAt(i)>='0' && str.charAt(i)<='9'){
99
numStr+=str.charAt(i);
1010
}else{
11-
if(numStr.length()>0)
11+
if(numStr.length()>0){
1212
num=Integer.parseInt(numStr);
1313
sum=sum+num;
14+
}
1415
numStr="";
1516
}
1617
}
@@ -21,4 +22,4 @@ public static void main(String[] args) {
2122
}
2223
System.out.println(sum);
2324
}
24-
}
25+
}

0 commit comments

Comments
 (0)