From 591b249e7ee2e5a23bb9a25691c63c49db8677f1 Mon Sep 17 00:00:00 2001 From: mko Date: Wed, 22 May 2024 14:16:02 +0200 Subject: [PATCH] Renames variable to increase maintainability Fixes: SIRI-960 --- src/main/java/sirius/kernel/commons/Strings.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/sirius/kernel/commons/Strings.java b/src/main/java/sirius/kernel/commons/Strings.java index 5186bbb6..58993ae5 100644 --- a/src/main/java/sirius/kernel/commons/Strings.java +++ b/src/main/java/sirius/kernel/commons/Strings.java @@ -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; } }