Optimized trimTrailingSpaces
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1300780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
861da51f24
commit
35b954ed36
|
@ -435,8 +435,12 @@ class CSVLexer {
|
|||
}
|
||||
|
||||
private void trimTrailingSpaces(StringBuilder buffer) {
|
||||
while (buffer.length() > 0 && Character.isWhitespace(buffer.charAt(buffer.length() - 1))) {
|
||||
buffer.setLength(buffer.length() - 1);
|
||||
int length = buffer.length();
|
||||
while (length > 0 && Character.isWhitespace(buffer.charAt(length - 1))) {
|
||||
length = length - 1;
|
||||
}
|
||||
if (length != buffer.length()) {
|
||||
buffer.setLength(length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue