mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 22:19:03 +00:00
Avoid unnecessary String instantiation in StringUtils.deleteAny()
This commit avoids unnecessary String instantiation in StringUtils.deleteAny() if nothing was deleted from the input string. Closes gh-24924
This commit is contained in:
@@ -461,6 +461,9 @@ public abstract class StringUtils {
|
||||
result[lastCharIndex++] = c;
|
||||
}
|
||||
}
|
||||
if (lastCharIndex == inString.length()) {
|
||||
return inString;
|
||||
}
|
||||
return new String(result, 0, lastCharIndex);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user