We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e630d6c commit a8a55baCopy full SHA for a8a55ba
1 file changed
code/InputParser.java
@@ -1,13 +1,9 @@
1
public class InputParser {
2
3
- // Parses level from an input string like "level:3"
4
public static int parseLevel(String input) {
5
- // BUG 1: assumes the string always has "level:" and a valid number
6
String[] parts = input.split(":");
7
- String numberPart = parts[1]; // can throw if input is wrong
+ String numberPart = parts[1];
8
9
- // BUG 2: doesn't trim spaces, can cause NumberFormatException
10
return Integer.parseInt(numberPart);
11
}
12
13
-
0 commit comments