From 9cc3be85cbaa4c46424e53e18f4bb541c06d4ff2 Mon Sep 17 00:00:00 2001 From: Markus KARG Date: Fri, 9 Aug 2024 12:30:31 +0000 Subject: [PATCH] Simplified Strings::startsWith --- src/main/java/com/beust/jcommander/Strings.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/beust/jcommander/Strings.java b/src/main/java/com/beust/jcommander/Strings.java index 0ddacd28..74b84e80 100644 --- a/src/main/java/com/beust/jcommander/Strings.java +++ b/src/main/java/com/beust/jcommander/Strings.java @@ -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 args) {