[jOOQ/jOOQ#8803] Improve performance of StringUtils#replace()
Replace `buf.append(text.substring(start, end))` with `buf.append(text, start, end)` in `StringUtils#replace()`.
This commit is contained in:
parent
5b26bd463d
commit
8ceaf4ebf1
@ -780,14 +780,14 @@ public final class StringUtils {
|
||||
increase *= (max < 0 ? 16 : (max > 64 ? 64 : max));
|
||||
StringBuilder buf = new StringBuilder(text.length() + increase);
|
||||
while (end != INDEX_NOT_FOUND) {
|
||||
buf.append(text.substring(start, end)).append(replacement);
|
||||
buf.append(text, start, end).append(replacement);
|
||||
start = end + replLength;
|
||||
if (--max == 0) {
|
||||
break;
|
||||
}
|
||||
end = text.indexOf(searchString, start);
|
||||
}
|
||||
buf.append(text.substring(start));
|
||||
buf.append(text, start, text.length());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user