Oleksandr Hasheniuk opened SPR-16766 and commented
Cutting whitespaces once prevents calling System#arrayCopy on every deleted char. With using String#substring method it would be called just once.
Affects: 5.0.5
Referenced from: pull request #1805, and commits 6545cab, 5a1d7f9