Skip to content

Commit

Permalink
Simplified Strings::startsWith
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Aug 9, 2024
1 parent 7c42947 commit 9cc3be8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/main/java/com/beust/jcommander/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ public static boolean isStringEmpty(String s) {
}

public static boolean startsWith(String s, String with, boolean isCaseSensitive) {
if (isCaseSensitive)
return s.startsWith(with);
else {
return s.toLowerCase().startsWith(with.toLowerCase());
}
return isCaseSensitive ? s.startsWith(with) : s.toLowerCase().startsWith(with.toLowerCase());
}

public static String join(String delimiter, List<String> args) {
Expand Down

0 comments on commit 9cc3be8

Please sign in to comment.