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:
parent
87f28ce48e
commit
87fa2c3b97
|
@ -461,6 +461,9 @@ public abstract class StringUtils {
|
||||||
result[lastCharIndex++] = c;
|
result[lastCharIndex++] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lastCharIndex == inString.length()) {
|
||||||
|
return inString;
|
||||||
|
}
|
||||||
return new String(result, 0, lastCharIndex);
|
return new String(result, 0, lastCharIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue