Skip to content

Commit

Permalink
Renames variable to increase maintainability
Browse files Browse the repository at this point in the history
Fixes: SIRI-960
  • Loading branch information
mko-sci committed May 22, 2024
1 parent 36a10ad commit 591b249
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/sirius/kernel/commons/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,12 @@ public static String limit(@Nullable Object input, int length, boolean showEllip
if (isEmpty(input) || length <= 0) {
return "";
}
String str = String.valueOf(input).trim();
if (str.length() > length) {
return str.substring(0, (showEllipsis ? length - ELLIPSIS.length() : length)) + (showEllipsis ? ELLIPSIS : "");
String trimmedInputString = String.valueOf(input).trim();
if (trimmedInputString.length() > length) {
return trimmedInputString.substring(0, (showEllipsis ? length - ELLIPSIS.length() : length))
+ (showEllipsis ? ELLIPSIS : "");
} else {
return str;
return trimmedInputString;
}
}

Expand Down

0 comments on commit 591b249

Please sign in to comment.