/*
*******************************************************************************
*
-* Copyright (C) 1999-2004, International Business Machines
+* Copyright (C) 1999-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#include "unicode/uchar.h"
#include "unicode/unistr.h"
+U_NAMESPACE_BEGIN
+
UnicodeString&
UnicodeString::trim()
{
return *this;
}
+ UChar *array = getArrayStart();
UChar32 c;
- int32_t i = fLength, length;
+ int32_t oldLength = this->length();
+ int32_t i = oldLength, length;
// first cut off trailing white space
for(;;) {
if(i <= 0) {
break;
}
- UTF_PREV_CHAR(fArray, 0, i, c);
+ U16_PREV(array, 0, i, c);
if(!(c == 0x20 || u_isWhitespace(c))) {
break;
}
}
- if(length < fLength) {
- fLength = length;
+ if(length < oldLength) {
+ setLength(length);
}
// find leading white space
if(i >= length) {
break;
}
- UTF_NEXT_CHAR(fArray, i, length, c);
+ U16_NEXT(array, i, length, c);
if(!(c == 0x20 || u_isWhitespace(c))) {
break;
}
return *this;
}
+
+U_NAMESPACE_END