We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f9139d commit a7eeee2Copy full SHA for a7eeee2
1 file changed
src/main/java/com/thealgorithms/strings/MyAtoi.java
@@ -45,7 +45,9 @@ public static int myAtoi(String s) {
45
int number = 0;
46
while (index < length) {
47
char ch = s.charAt(index);
48
- if (!Character.isDigit(ch)) {
+
49
+ // Accept only ASCII digits
50
+ if (ch < '0' || ch > '9') {
51
break;
52
}
53
0 commit comments