Skip to content

Commit a8a55ba

Browse files
authored
Update InputParser.java
1 parent e630d6c commit a8a55ba

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

code/InputParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
public class InputParser {
22

3-
// Parses level from an input string like "level:3"
43
public static int parseLevel(String input) {
5-
// BUG 1: assumes the string always has "level:" and a valid number
64
String[] parts = input.split(":");
7-
String numberPart = parts[1]; // can throw if input is wrong
5+
String numberPart = parts[1];
86

9-
// BUG 2: doesn't trim spaces, can cause NumberFormatException
107
return Integer.parseInt(numberPart);
118
}
129
}
13-

0 commit comments

Comments
 (0)