ICU-170 use UnicodeString::length() instead of the deprecated size()

X-SVN-Rev: 339
This commit is contained in:
Markus Scherer 1999-12-08 02:11:04 +00:00
parent 1e7ac47da4
commit 54ba2e3819
39 changed files with 297 additions and 297 deletions

View File

@ -43,7 +43,7 @@ UnicodeConverterCPP::UnicodeConverterCPP(const UnicodeString& name, UErrorCode&
{ {
char myName[UCNV_MAX_CONVERTER_NAME_LENGTH]; char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
int i; int i;
name.extract(0, i = name.size(), myName); name.extract(0, i = name.length(), myName);
myName[i]='\0'; myName[i]='\0';
myUnicodeConverter = ucnv_open(myName, &err); myUnicodeConverter = ucnv_open(myName, &err);
} }
@ -139,7 +139,7 @@ UnicodeConverterCPP::fromUnicodeString(char* target,
ucnv_reset(&myConverter); ucnv_reset(&myConverter);
mySourceLength = source.size(); mySourceLength = source.length();
mySource = source.getUChars(); mySource = source.getUChars();
myTarget = target; myTarget = target;
ucnv_fromUnicode(&myConverter, ucnv_fromUnicode(&myConverter,
@ -211,7 +211,7 @@ UnicodeConverterCPP::toUnicodeString(UnicodeString& target,
&err); &err);
/*appends what we got thus far to the UnicodeString*/ /*appends what we got thus far to the UnicodeString*/
target.replace((UTextOffset)target.size(), target.replace((UTextOffset)target.length(),
myTargetUCharsAlias - myTargetUChars, myTargetUCharsAlias - myTargetUChars,
myTargetUChars, myTargetUChars,
myTargetUCharsAlias - myTargetUChars); myTargetUCharsAlias - myTargetUChars);

View File

@ -15,10 +15,10 @@ void T_fillOutputParams(const UnicodeString* temp,
UErrorCode* status) UErrorCode* status)
{ {
const int32_t actual = temp->size(); const int32_t actual = temp->length();
const bool_t overflowed = actual >= resultLength; const bool_t overflowed = actual >= resultLength;
const int32_t returnedSize = icu_min(actual, resultLength-1); const int32_t returnedSize = icu_min(actual, resultLength-1);
if ((temp->size() < resultLength) && (result != temp->getUChars()) && (returnedSize > 0)) { if ((temp->length() < resultLength) && (result != temp->getUChars()) && (returnedSize > 0)) {
u_strcpy(result, temp->getUChars()); u_strcpy(result, temp->getUChars());
} }

View File

@ -172,20 +172,20 @@ Locale::Locale( const UnicodeString& newLanguage,
UnicodeString newVariantCopy(newVariant); UnicodeString newVariantCopy(newVariant);
if (newCountry.size() > 0 || if (newCountry.length() > 0 ||
newVariantCopy.size() > 0 ) newVariantCopy.length() > 0 )
{ {
togo += sep; togo += sep;
togo += newCountry; togo += newCountry;
} }
int vsize = newVariantCopy.size(); int vsize = newVariantCopy.length();
if (vsize > 0) if (vsize > 0)
{ {
int i = 0; int i = 0;
//We need to trim variant codes : (_*)$var(_*) --> $var //We need to trim variant codes : (_*)$var(_*) --> $var
while ((i<vsize) && newVariantCopy[i] == sep) newVariantCopy.remove(i++, 1); while ((i<vsize) && newVariantCopy[i] == sep) newVariantCopy.remove(i++, 1);
i = newVariantCopy.size() - 1; i = newVariantCopy.length() - 1;
while (i && (newVariantCopy[i] == sep)) newVariantCopy.remove(i--, 1); while (i && (newVariantCopy[i] == sep)) newVariantCopy.remove(i--, 1);
togo += sep ; togo += sep ;
@ -331,7 +331,7 @@ Locale::setHashCode()
fullNameUString += UnicodeString(country, ""); fullNameUString += UnicodeString(country, "");
fullNameUString += UnicodeString(variant, ""); fullNameUString += UnicodeString(variant, "");
const UChar *key = fullNameUString.getUChars(); const UChar *key = fullNameUString.getUChars();
int32_t len = fullNameUString.size(); int32_t len = fullNameUString.length();
int32_t hash = 0; int32_t hash = 0;
const UChar *limit = key + len; const UChar *limit = key + len;
int32_t inc = (len >= 128 ? len/64 : 1); int32_t inc = (len >= 128 ? len/64 : 1);
@ -431,7 +431,7 @@ Locale::getISO3Language(UnicodeString& lang, UErrorCode& status) const
return lang; return lang;
lang = uloc_getISO3Language(fullName); lang = uloc_getISO3Language(fullName);
if (lang.size() == 0) if (lang.length() == 0)
status = U_MISSING_RESOURCE_ERROR; status = U_MISSING_RESOURCE_ERROR;
return lang; return lang;
@ -452,7 +452,7 @@ Locale::getISO3Country(UnicodeString& cntry, UErrorCode& status) const
return cntry; return cntry;
cntry = uloc_getISO3Country(fullName); cntry = uloc_getISO3Country(fullName);
if (cntry.size() == 0) if (cntry.length() == 0)
status = U_MISSING_RESOURCE_ERROR; status = U_MISSING_RESOURCE_ERROR;
return cntry; return cntry;
@ -778,7 +778,7 @@ Locale::getLanguagesForCountry(const UnicodeString& country, int32_t& count)
break; break;
UnicodeString compressedValues; UnicodeString compressedValues;
compressedCtry2LangMapping.extractBetween(i, j, compressedValues); compressedCtry2LangMapping.extractBetween(i, j, compressedValues);
UnicodeString *values = new UnicodeString[compressedValues.size() / 2]; UnicodeString *values = new UnicodeString[compressedValues.length() / 2];
int32_t valLen = sizeof(values) / sizeof(values[0]); int32_t valLen = sizeof(values) / sizeof(values[0]);
for (int32_t k = 0; k < valLen; ++k) for (int32_t k = 0; k < valLen; ++k)
compressedValues.extractBetween(k * 2, (k * 2) + 2, values[k]); compressedValues.extractBetween(k * 2, (k * 2) + 2, values[k]);

View File

@ -188,14 +188,14 @@ Normalizer::compose(const UnicodeString& source,
uint16_t minDecomp = compat ? 0 : DecompData::MAX_COMPAT; uint16_t minDecomp = compat ? 0 : DecompData::MAX_COMPAT;
UTextOffset i = 0; UTextOffset i = 0;
while (i < source.size() || explodePos != EMPTY) { while (i < source.length() || explodePos != EMPTY) {
// Get the next char from either the buffer or the source // Get the next char from either the buffer or the source
UChar ch; UChar ch;
if (explodePos == EMPTY) { if (explodePos == EMPTY) {
ch = source[i++]; ch = source[i++];
} else { } else {
ch = explodeBuf[explodePos++]; ch = explodeBuf[explodePos++];
if (explodePos >= explodeBuf.size()) { if (explodePos >= explodeBuf.length()) {
explodePos = EMPTY; explodePos = EMPTY;
explodeBuf.truncate(0); explodeBuf.truncate(0);
} }
@ -209,7 +209,7 @@ Normalizer::compose(const UnicodeString& source,
if (type == ComposeData::BASE) { if (type == ComposeData::BASE) {
classesSeen = 0; classesSeen = 0;
baseIndex = index; baseIndex = index;
basePos = result.size(); basePos = result.length();
result += ch; result += ch;
} }
else if (type == ComposeData::COMBINING || type == ComposeData::NON_COMPOSING_COMBINING) else if (type == ComposeData::COMBINING || type == ComposeData::NON_COMPOSING_COMBINING)
@ -244,7 +244,7 @@ Normalizer::compose(const UnicodeString& source,
// base character. There are only four characters in Unicode that have // base character. There are only four characters in Unicode that have
// this problem. If they are fixed in Unicode 3.0, this code can go away. // this problem. If they are fixed in Unicode 3.0, this code can go away.
// //
UTextOffset len = result.size(); UTextOffset len = result.length();
if (len - basePos > 1) { if (len - basePos > 1) {
for (UTextOffset j = basePos+1; j < len; j++) { for (UTextOffset j = basePos+1; j < len; j++) {
explodeBuf += result[j]; explodeBuf += result[j];
@ -273,7 +273,7 @@ Normalizer::compose(const UnicodeString& source,
else if (type == ComposeData::INITIAL_JAMO) { else if (type == ComposeData::INITIAL_JAMO) {
classesSeen = 0; classesSeen = 0;
baseIndex = ComposeData::INITIAL_JAMO_INDEX; baseIndex = ComposeData::INITIAL_JAMO_INDEX;
basePos = result.size(); basePos = result.length();
result += ch; result += ch;
} }
else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0 else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0
@ -345,14 +345,14 @@ UChar Normalizer::nextCompose()
uint16_t index = charInfo >> ComposeData::INDEX_SHIFT; uint16_t index = charInfo >> ComposeData::INDEX_SHIFT;
if (type == ComposeData::BASE) { if (type == ComposeData::BASE) {
if (buffer.size() > 0 && chFromText && explodePos == EMPTY) { if (buffer.length() > 0 && chFromText && explodePos == EMPTY) {
// When we hit a base char in the source text, we can return the text // When we hit a base char in the source text, we can return the text
// that's been composed so far. We'll re-process this char next time through. // that's been composed so far. We'll re-process this char next time through.
break; break;
} }
classesSeen = 0; classesSeen = 0;
baseIndex = index; baseIndex = index;
basePos = buffer.size(); basePos = buffer.length();
buffer += ch; buffer += ch;
lastBase = ch; lastBase = ch;
} }
@ -390,7 +390,7 @@ UChar Normalizer::nextCompose()
// base character. There are only four characters in Unicode that have // base character. There are only four characters in Unicode that have
// this problem. If they are fixed in Unicode 3.0, this code can go away. // this problem. If they are fixed in Unicode 3.0, this code can go away.
// //
UTextOffset len = buffer.size(); UTextOffset len = buffer.length();
if (len - basePos > 1) { if (len - basePos > 1) {
for (UTextOffset j = basePos+1; j < len; j++) { for (UTextOffset j = basePos+1; j < len; j++) {
explodeBuf += buffer[j]; explodeBuf += buffer[j];
@ -417,14 +417,14 @@ UChar Normalizer::nextCompose()
explodePos = 0; explodePos = 0;
} }
else if (type == ComposeData::INITIAL_JAMO) { else if (type == ComposeData::INITIAL_JAMO) {
if (buffer.size() > 0 && chFromText && explodePos == EMPTY) { if (buffer.length() > 0 && chFromText && explodePos == EMPTY) {
// When we hit a base char in the source text, we can return the text // When we hit a base char in the source text, we can return the text
// that's been composed so far. We'll re-process this char next time through. // that's been composed so far. We'll re-process this char next time through.
break; break;
} }
classesSeen = 0; classesSeen = 0;
baseIndex = ComposeData::INITIAL_JAMO_INDEX; baseIndex = ComposeData::INITIAL_JAMO_INDEX;
basePos = buffer.size(); basePos = buffer.length();
buffer += ch; buffer += ch;
} }
else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0 else if (type == ComposeData::MEDIAL_JAMO && classesSeen == 0
@ -461,15 +461,15 @@ UChar Normalizer::nextCompose()
chFromText = TRUE; chFromText = TRUE;
} else { } else {
ch = explodeBuf[explodePos++]; ch = explodeBuf[explodePos++];
if (explodePos >= explodeBuf.size()) { if (explodePos >= explodeBuf.length()) {
explodePos = EMPTY; explodePos = EMPTY;
explodeBuf.truncate(0); explodeBuf.truncate(0);
} }
chFromText = FALSE; chFromText = FALSE;
} }
} }
if (buffer.size() > 0) { if (buffer.length() > 0) {
bufferLimit = buffer.size() - 1; bufferLimit = buffer.length() - 1;
ch = buffer[0]; ch = buffer[0];
} else { } else {
ch = DONE; ch = DONE;
@ -514,7 +514,7 @@ UChar Normalizer::prevCompose()
} }
} }
// If there's more than one character in the buffer, compose it all at once.... // If there's more than one character in the buffer, compose it all at once....
if (buffer.size() > 0) { if (buffer.length() > 0) {
// TODO: The performance of this is awful; add a way to compose // TODO: The performance of this is awful; add a way to compose
// a UnicodeString& in place. // a UnicodeString& in place.
UnicodeString composed; UnicodeString composed;
@ -522,8 +522,8 @@ UChar Normalizer::prevCompose()
buffer.truncate(0); buffer.truncate(0);
buffer += composed; buffer += composed;
if (buffer.size() > 1) { if (buffer.length() > 1) {
bufferLimit = bufferPos = buffer.size() - 1; bufferLimit = bufferPos = buffer.length() - 1;
ch = buffer[bufferPos]; ch = buffer[bufferPos];
} else { } else {
ch = buffer[0]; ch = buffer[0];
@ -538,7 +538,7 @@ UChar Normalizer::prevCompose()
void Normalizer::bubbleAppend(UnicodeString& target, UChar ch, uint32_t cclass) { void Normalizer::bubbleAppend(UnicodeString& target, UChar ch, uint32_t cclass) {
UTextOffset i; UTextOffset i;
for (i = target.size() - 1; i > 0; --i) { for (i = target.length() - 1; i > 0; --i) {
uint32_t iClass = getComposeClass(target[i]); uint32_t iClass = getComposeClass(target[i]);
if (iClass == 1 || iClass <= cclass) { // 1 means combining class 0 if (iClass == 1 || iClass <= cclass) { // 1 means combining class 0
@ -602,7 +602,7 @@ Normalizer::decompose(const UnicodeString& source,
result.truncate(0); result.truncate(0);
for (UTextOffset i = 0; i < source.size(); ++i) { for (UTextOffset i = 0; i < source.length(); ++i) {
UChar ch = source[i]; UChar ch = source[i];
uint16_t offset = ucmp16_getu(DecompData::offsets, ch); uint16_t offset = ucmp16_getu(DecompData::offsets, ch);
@ -666,14 +666,14 @@ UChar Normalizer::nextDecomp()
buffer += ch; buffer += ch;
} }
if (buffer.size() > 1 && needToReorder) { if (buffer.length() > 1 && needToReorder) {
// If there is more than one combining character in the buffer, // If there is more than one combining character in the buffer,
// put them into the canonical order. // put them into the canonical order.
// But we don't need to sort if only characters are the ones that // But we don't need to sort if only characters are the ones that
// resulted from decomosing the base character. // resulted from decomosing the base character.
fixCanonical(buffer); fixCanonical(buffer);
} }
bufferLimit = buffer.size() - 1; bufferLimit = buffer.length() - 1;
ch = buffer[0]; ch = buffer[0];
} else { } else {
// Just use this character, but first advance to the next one // Just use this character, but first advance to the next one
@ -683,7 +683,7 @@ UChar Normalizer::nextDecomp()
if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) { if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) {
initBuffer(); initBuffer();
hangulToJamo(ch, buffer, minDecomp); hangulToJamo(ch, buffer, minDecomp);
bufferLimit = buffer.size() - 1; bufferLimit = buffer.length() - 1;
ch = buffer[0]; ch = buffer[0];
} }
} }
@ -733,18 +733,18 @@ UChar Normalizer::prevDecomp() {
text->next(); text->next();
} }
if (buffer.size() > 1) { if (buffer.length() > 1) {
// If there is more than one combining character in the buffer, // If there is more than one combining character in the buffer,
// put them into the canonical order. // put them into the canonical order.
fixCanonical(buffer); fixCanonical(buffer);
} }
bufferLimit = bufferPos = buffer.size() - 1; bufferLimit = bufferPos = buffer.length() - 1;
ch = buffer[bufferPos]; ch = buffer[bufferPos];
} }
else if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) { else if (hangul && ch >= HANGUL_BASE && ch < HANGUL_LIMIT) {
initBuffer(); initBuffer();
hangulToJamo(ch, buffer, minDecomp); hangulToJamo(ch, buffer, minDecomp);
bufferLimit = bufferPos = buffer.size() - 1; bufferLimit = bufferPos = buffer.length() - 1;
ch = buffer[bufferPos]; ch = buffer[bufferPos];
} }
return ch; return ch;
@ -762,7 +762,7 @@ uint8_t Normalizer::getClass(UChar ch) {
* @param result the string to fix. * @param result the string to fix.
*/ */
void Normalizer::fixCanonical(UnicodeString& result) { void Normalizer::fixCanonical(UnicodeString& result) {
UTextOffset i = result.size() - 1; UTextOffset i = result.length() - 1;
uint8_t currentType = getClass(result[i]); uint8_t currentType = getClass(result[i]);
uint8_t lastType; uint8_t lastType;
@ -781,7 +781,7 @@ void Normalizer::fixCanonical(UnicodeString& result) {
result[i+1] = temp; result[i+1] = temp;
// if not at end, backup (one further, to compensate for for-loop) // if not at end, backup (one further, to compensate for for-loop)
if (i < result.size() - 2) { if (i < result.length() - 2) {
i += 2; i += 2;
} }
// reset type, since we swapped. // reset type, since we swapped.
@ -1159,7 +1159,7 @@ void Normalizer::jamoAppend(UChar ch, uint16_t decompLimit, UnicodeString& dest)
void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) { void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) {
UTextOffset out = start; UTextOffset out = start;
UTextOffset limit = buffer.size() - 1; UTextOffset limit = buffer.length() - 1;
UTextOffset in; UTextOffset in;
uint16_t l, v, t; uint16_t l, v, t;
@ -1188,7 +1188,7 @@ void Normalizer::jamoToHangul(UnicodeString& buffer, UTextOffset start) {
buffer[out++] = ch; buffer[out++] = ch;
} }
} }
while (in < buffer.size()) { while (in < buffer.length()) {
buffer[out++] = buffer[in++]; buffer[out++] = buffer[in++];
} }

View File

@ -225,7 +225,7 @@ ResourceBundle::LocaleFallbackIterator::nextLocale(UErrorCode& status)
if(status != U_USING_DEFAULT_ERROR) if(status != U_USING_DEFAULT_ERROR)
status = U_USING_FALLBACK_ERROR; status = U_USING_FALLBACK_ERROR;
if(fLocale.size() == 0) { if(fLocale.length() == 0) {
if(fUseDefaultLocale && !fTriedDefaultLocale) { if(fUseDefaultLocale && !fTriedDefaultLocale) {
fLocale = fDefaultLocale; fLocale = fDefaultLocale;
fTriedDefaultLocale = TRUE; fTriedDefaultLocale = TRUE;
@ -249,7 +249,7 @@ ResourceBundle::LocaleFallbackIterator::nextLocale(UErrorCode& status)
void void
ResourceBundle::LocaleFallbackIterator::chopLocale() ResourceBundle::LocaleFallbackIterator::chopLocale()
{ {
int32_t size = fLocale.size(); int32_t size = fLocale.length();
int32_t i; int32_t i;
for(i = size - 1; i > 0; i--) for(i = size - 1; i > 0; i--)
@ -381,7 +381,7 @@ ResourceBundle::constructForLocale(const PathInfo& path,
// fRealLocale can be inited in three ways, see 1), 2), 3) // fRealLocale can be inited in three ways, see 1), 2), 3)
UnicodeString returnedLocale; UnicodeString returnedLocale;
locale.getName(returnedLocale); locale.getName(returnedLocale);
if (returnedLocale.size()!=0) { if (returnedLocale.length()!=0) {
// 1) Desired Locale has a name // 1) Desired Locale has a name
fRealLocale = Locale(returnedLocale); fRealLocale = Locale(returnedLocale);
} else { } else {
@ -922,8 +922,8 @@ ResourceBundle::getVersionNumber() const
// the end). // the end).
int32_t len = icu_strlen(ICU_VERSION); int32_t len = icu_strlen(ICU_VERSION);
int32_t minor_len = 0; int32_t minor_len = 0;
if(U_SUCCESS(status) && minor_version.size() > 0) if(U_SUCCESS(status) && minor_version.length() > 0)
minor_len = minor_version.size(); minor_len = minor_version.length();
len += (minor_len > 0) ? minor_len : 1 /*==icu_strlen(kDefaultMinorVersion)*/; len += (minor_len > 0) ? minor_len : 1 /*==icu_strlen(kDefaultMinorVersion)*/;
++len; // Add length of separator ++len; // Add length of separator
@ -1289,7 +1289,7 @@ ResourceBundle::PathInfo::openFile(const UnicodeString& localeName) const
{ {
if(fWPrefix) { if(fWPrefix) {
//use the wide version of fopen in TPlatformUtilities. //use the wide version of fopen in TPlatformUtilities.
int32_t nameSize = localeName.size(); int32_t nameSize = localeName.length();
char* temp = new char[nameSize + 1]; char* temp = new char[nameSize + 1];
localeName.extract(0, nameSize, temp); localeName.extract(0, nameSize, temp);
temp[nameSize] = 0; temp[nameSize] = 0;
@ -1328,7 +1328,7 @@ ResourceBundle::PathInfo::openFile(const UnicodeString& localeName) const
else { else {
//open file using standard char* routines //open file using standard char* routines
UnicodeString workingName(makeCacheKey(localeName)); UnicodeString workingName(makeCacheKey(localeName));
int32_t size = workingName.size(); int32_t size = workingName.length();
char* returnVal = new char[size + 1]; char* returnVal = new char[size + 1];
workingName.extract(0, size, returnVal, ""); workingName.extract(0, size, returnVal, "");
returnVal[size] = 0; returnVal[size] = 0;

View File

@ -1296,7 +1296,7 @@ T_UnicodeString_getUChars(const UnicodeString *s)
U_CFUNC int32_t U_CFUNC int32_t
T_UnicodeString_extract(const UnicodeString *s, char *dst) T_UnicodeString_extract(const UnicodeString *s, char *dst)
{ {
return s->extract(0,s->size(),dst,""); return s->extract(0, s->length(), dst, "");
} }

View File

@ -671,7 +671,7 @@ int32_t Calendar::stringToDayNumber(const UnicodeString& string, UErrorCode& sta
// ResourceBundle returns all data in string form, so we have to convert it here.) // ResourceBundle returns all data in string form, so we have to convert it here.)
if (U_FAILURE(status)) return 0; if (U_FAILURE(status)) return 0;
int32_t len = string.size(); int32_t len = string.length();
char *number = new char[1 + len]; char *number = new char[1 + len];
if (number == 0) { status = U_MEMORY_ALLOCATION_ERROR; return 0; } if (number == 0) { status = U_MEMORY_ALLOCATION_ERROR; return 0; }
char *end; char *end;

View File

@ -240,11 +240,11 @@ ChoiceFormat::applyPattern(const UnicodeString& newPattern,
double startValue = 0; double startValue = 0;
double oldStartValue = icu_getNaN(); double oldStartValue = icu_getNaN();
bool_t inQuote = FALSE; bool_t inQuote = FALSE;
for(int i = 0; i < newPattern.size(); ++i) { for(int i = 0; i < newPattern.length(); ++i) {
UChar ch = newPattern[i]; UChar ch = newPattern[i];
if(ch == 0x0027 /*'\''*/) { if(ch == 0x0027 /*'\''*/) {
// Check for "''" indicating a literal quote // Check for "''" indicating a literal quote
if((i+1) < newPattern.size() && newPattern[i+1] == ch) { if((i+1) < newPattern.length() && newPattern[i+1] == ch) {
segments[part] += ch; segments[part] += ch;
++i; ++i;
} }
@ -367,7 +367,7 @@ ChoiceFormat::toPattern(UnicodeString& result) const
if (text.indexOf(0x0027 /*'\''*/) < 0) if (text.indexOf(0x0027 /*'\''*/) < 0)
result += text; result += text;
else { else {
for (int j = 0; j < text.size(); ++j) { for (int j = 0; j < text.length(); ++j) {
UChar c = text[j]; UChar c = text[j];
result += c; result += c;
if (c == 0x0027 /*'\''*/) if (c == 0x0027 /*'\''*/)
@ -532,13 +532,13 @@ ChoiceFormat::parse(const UnicodeString& text,
double tempNumber = 0.0; double tempNumber = 0.0;
for (int i = 0; i < fCount; ++i) { for (int i = 0; i < fCount; ++i) {
UnicodeString tempString = fChoiceFormats[i]; UnicodeString tempString = fChoiceFormats[i];
if(text.compareBetween(start, tempString.size(), tempString, 0, tempString.size()) == 0) { if(text.compareBetween(start, tempString.length(), tempString, 0, tempString.length()) == 0) {
status.setIndex(start + tempString.size()); status.setIndex(start + tempString.length());
tempNumber = fChoiceLimits[i]; tempNumber = fChoiceLimits[i];
if (status.getIndex() > furthest) { if (status.getIndex() > furthest) {
furthest = status.getIndex(); furthest = status.getIndex();
bestNumber = tempNumber; bestNumber = tempNumber;
if (furthest == text.size()) if (furthest == text.length())
break; break;
} }
} }

View File

@ -69,7 +69,7 @@ CollationElementIterator::CollationElementIterator( const UnicodeString& sourceT
return; return;
} }
if ( sourceText.size() != 0 ) { if ( sourceText.length() != 0 ) {
// //
// A CollationElementIterator is really a two-layered beast. // A CollationElementIterator is really a two-layered beast.
// Internally it uses a Normalizer to munge the source text // Internally it uses a Normalizer to munge the source text

View File

@ -228,7 +228,7 @@ DecimalFormatSymbols::initialize(const UnicodeString* numberElements, const Unic
// if the resource data specified the empty string as the monetary decimal // if the resource data specified the empty string as the monetary decimal
// separator, that means we should just use the regular separator as the // separator, that means we should just use the regular separator as the
// monetary separator // monetary separator
if(currencyElements[2].size() == 0) if(currencyElements[2].length() == 0)
fMonetarySeparator = fDecimalSeparator; fMonetarySeparator = fDecimalSeparator;
else else
fMonetarySeparator = currencyElements[2][(UTextOffset)0]; fMonetarySeparator = currencyElements[2][(UTextOffset)0];

View File

@ -522,13 +522,13 @@ DecimalFormat::format( double number,
if (icu_isNaN(number)) if (icu_isNaN(number))
{ {
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
UnicodeString nan; UnicodeString nan;
result += fSymbols->getNaN(nan); result += fSymbols->getNaN(nan);
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
addPadding(result, FALSE, FALSE /*ignored*/); addPadding(result, FALSE, FALSE /*ignored*/);
return result; return result;
@ -566,13 +566,13 @@ DecimalFormat::format( double number,
result += (isNegative ? fNegativePrefix : fPositivePrefix); result += (isNegative ? fNegativePrefix : fPositivePrefix);
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
UnicodeString inf; UnicodeString inf;
result += fSymbols->getInfinity(inf); result += fSymbols->getInfinity(inf);
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
result += (isNegative ? fNegativeSuffix : fPositiveSuffix); result += (isNegative ? fNegativeSuffix : fPositiveSuffix);
@ -678,7 +678,7 @@ DecimalFormat::subformat(UnicodeString& result,
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
{ {
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
fieldPosition.setEndIndex(-1); fieldPosition.setEndIndex(-1);
} }
else if (fieldPosition.getField() == NumberFormat::kFractionField) else if (fieldPosition.getField() == NumberFormat::kFractionField)
@ -731,13 +731,13 @@ DecimalFormat::subformat(UnicodeString& result,
{ {
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
result += (decimal); result += (decimal);
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kFractionField) if (fieldPosition.getField() == NumberFormat::kFractionField)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
} }
// Restores the digit character or pads the buffer with zeros. // Restores the digit character or pads the buffer with zeros.
UChar c = ((i < fDigitList->fCount) ? UChar c = ((i < fDigitList->fCount) ?
@ -750,13 +750,13 @@ DecimalFormat::subformat(UnicodeString& result,
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
{ {
if (fieldPosition.getEndIndex() < 0) if (fieldPosition.getEndIndex() < 0)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
} }
else if (fieldPosition.getField() == NumberFormat::kFractionField) else if (fieldPosition.getField() == NumberFormat::kFractionField)
{ {
if (fieldPosition.getBeginIndex() < 0) if (fieldPosition.getBeginIndex() < 0)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
} }
// The exponent is output using the pattern-specified minimum // The exponent is output using the pattern-specified minimum
@ -793,7 +793,7 @@ DecimalFormat::subformat(UnicodeString& result,
{ {
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
// Output the integer portion. Here 'count' is the total // Output the integer portion. Here 'count' is the total
// number of integer digits we will display, including both // number of integer digits we will display, including both
@ -815,7 +815,7 @@ DecimalFormat::subformat(UnicodeString& result,
digitIndex = fDigitList->fDecimalAt - count; digitIndex = fDigitList->fDecimalAt - count;
} }
int32_t sizeBeforeIntegerPart = result.size(); int32_t sizeBeforeIntegerPart = result.length();
int32_t i; int32_t i;
for (i=count-1; i>=0; --i) for (i=count-1; i>=0; --i)
@ -842,7 +842,7 @@ DecimalFormat::subformat(UnicodeString& result,
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kIntegerField) if (fieldPosition.getField() == NumberFormat::kIntegerField)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
// Determine whether or not there are any printable fractional // Determine whether or not there are any printable fractional
// digits. If we've used up the digits we know there aren't. // digits. If we've used up the digits we know there aren't.
@ -852,7 +852,7 @@ DecimalFormat::subformat(UnicodeString& result,
// If there is no fraction present, and we haven't printed any // If there is no fraction present, and we haven't printed any
// integer digits, then print a zero. Otherwise we won't print // integer digits, then print a zero. Otherwise we won't print
// _any_ digits, and we won't be able to parse this string. // _any_ digits, and we won't be able to parse this string.
if (!fractionPresent && result.size() == sizeBeforeIntegerPart) if (!fractionPresent && result.length() == sizeBeforeIntegerPart)
result += (zero); result += (zero);
// Output the decimal separator if we always do so. // Output the decimal separator if we always do so.
@ -861,7 +861,7 @@ DecimalFormat::subformat(UnicodeString& result,
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kFractionField) if (fieldPosition.getField() == NumberFormat::kFractionField)
fieldPosition.setBeginIndex(result.size()); fieldPosition.setBeginIndex(result.length());
for (i=0; i < getMaximumFractionDigits(); ++i) for (i=0; i < getMaximumFractionDigits(); ++i)
{ {
@ -897,7 +897,7 @@ DecimalFormat::subformat(UnicodeString& result,
// Record field information for caller. // Record field information for caller.
if (fieldPosition.getField() == NumberFormat::kFractionField) if (fieldPosition.getField() == NumberFormat::kFractionField)
fieldPosition.setEndIndex(result.size()); fieldPosition.setEndIndex(result.length());
} }
result += (isNegative ? fNegativeSuffix : fPositiveSuffix); result += (isNegative ? fNegativeSuffix : fPositiveSuffix);
@ -919,7 +919,7 @@ DecimalFormat::subformat(UnicodeString& result,
void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes, void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
bool_t isNegative) const { bool_t isNegative) const {
if (fFormatWidth > 0) { if (fFormatWidth > 0) {
int32_t len = fFormatWidth - result.size(); int32_t len = fFormatWidth - result.length();
if (len > 0) { if (len > 0) {
UChar* padding = (UChar*) icu_malloc(sizeof(UChar) * len); UChar* padding = (UChar*) icu_malloc(sizeof(UChar) * len);
for (int32_t i=0; i<len; ++i) { for (int32_t i=0; i<len; ++i) {
@ -928,8 +928,8 @@ void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
switch (fPadPosition) { switch (fPadPosition) {
case kPadAfterPrefix: case kPadAfterPrefix:
if (hasAffixes) { if (hasAffixes) {
result.insert(isNegative ? fNegativePrefix.size() result.insert(isNegative ? fNegativePrefix.length()
: fPositivePrefix.size(), : fPositivePrefix.length(),
padding, len); padding, len);
break; break;
} // else fall through to next case } // else fall through to next case
@ -938,9 +938,9 @@ void DecimalFormat::addPadding(UnicodeString& result, bool_t hasAffixes,
break; break;
case kPadBeforeSuffix: case kPadBeforeSuffix:
if (hasAffixes) { if (hasAffixes) {
result.insert(result.size() - result.insert(result.length() -
(isNegative ? fNegativeSuffix.size() (isNegative ? fNegativeSuffix.length()
: fPositiveSuffix.size()), : fPositiveSuffix.length()),
padding, len); padding, len);
break; break;
} // else fall through to next case } // else fall through to next case
@ -976,7 +976,7 @@ DecimalFormat::parse(const UnicodeString& text,
int32_t backup = parsePosition.getIndex(); int32_t backup = parsePosition.getIndex();
int32_t i = backup; int32_t i = backup;
if (fFormatWidth > 0) { if (fFormatWidth > 0) {
while (i < text.size() && text[(UTextOffset) i] == fPad) { while (i < text.length() && text[(UTextOffset) i] == fPad) {
++i; ++i;
} }
parsePosition.setIndex(i); parsePosition.setIndex(i);
@ -986,9 +986,9 @@ DecimalFormat::parse(const UnicodeString& text,
UnicodeString nan; UnicodeString nan;
fSymbols->getNaN(nan); fSymbols->getNaN(nan);
// If the text is composed of the representation of NaN, returns NaN. // If the text is composed of the representation of NaN, returns NaN.
if (text.compare(parsePosition.getIndex(), nan.size(), nan, if (text.compare(parsePosition.getIndex(), nan.length(), nan,
0, nan.size()) == 0) { 0, nan.length()) == 0) {
parsePosition.setIndex(parsePosition.getIndex() + nan.size()); parsePosition.setIndex(parsePosition.getIndex() + nan.length());
result.setDouble(icu_getNaN()); result.setDouble(icu_getNaN());
return; return;
} }
@ -1002,7 +1002,7 @@ DecimalFormat::parse(const UnicodeString& text,
return; return;
} else if (fFormatWidth < 0) { } else if (fFormatWidth < 0) {
i = parsePosition.getIndex(); i = parsePosition.getIndex();
while (i < text.size() && text[(UTextOffset) i] == fPad) { while (i < text.length() && text[(UTextOffset) i] == fPad) {
++i; ++i;
} }
parsePosition.setIndex(i); parsePosition.setIndex(i);
@ -1063,23 +1063,23 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
int32_t backup; int32_t backup;
// check for positivePrefix; take longest // check for positivePrefix; take longest
bool_t gotPositive = text.compare(position,fPositivePrefix.size(),fPositivePrefix,0, bool_t gotPositive = text.compare(position,fPositivePrefix.length(),fPositivePrefix,0,
fPositivePrefix.size()) == 0; fPositivePrefix.length()) == 0;
bool_t gotNegative = text.compare(position,fNegativePrefix.size(),fNegativePrefix,0, bool_t gotNegative = text.compare(position,fNegativePrefix.length(),fNegativePrefix,0,
fNegativePrefix.size()) == 0; fNegativePrefix.length()) == 0;
// If the number is positive and negative at the same time, // If the number is positive and negative at the same time,
// 1. the number is positive if the positive prefix is longer // 1. the number is positive if the positive prefix is longer
// 2. the number is negative if the negative prefix is longer // 2. the number is negative if the negative prefix is longer
if (gotPositive && gotNegative) { if (gotPositive && gotNegative) {
if (fPositivePrefix.size() > fNegativePrefix.size()) if (fPositivePrefix.length() > fNegativePrefix.length())
gotNegative = FALSE; gotNegative = FALSE;
else if (fPositivePrefix.size() < fNegativePrefix.size()) else if (fPositivePrefix.length() < fNegativePrefix.length())
gotPositive = FALSE; gotPositive = FALSE;
} }
if(gotPositive) if(gotPositive)
position += fPositivePrefix.size(); position += fPositivePrefix.length();
else if(gotNegative) else if(gotNegative)
position += fNegativePrefix.size(); position += fNegativePrefix.length();
else { else {
parsePosition.setErrorIndex(position); parsePosition.setErrorIndex(position);
return FALSE; return FALSE;
@ -1088,11 +1088,11 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
status[fgStatusInfinite] = FALSE; status[fgStatusInfinite] = FALSE;
UnicodeString inf; UnicodeString inf;
fSymbols->getInfinity(inf); fSymbols->getInfinity(inf);
if (!isExponent && text.compare(position,inf.size(),inf,0, if (!isExponent && text.compare(position,inf.length(),inf,0,
inf.size()) == 0) inf.length()) == 0)
{ {
// Found a infinite number. // Found a infinite number.
position += inf.size(); position += inf.length();
status[fgStatusInfinite] = TRUE; status[fgStatusInfinite] = TRUE;
} else { } else {
// We now have a string of digits, possibly with grouping symbols, // We now have a string of digits, possibly with grouping symbols,
@ -1120,7 +1120,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
int32_t digitCount = 0; int32_t digitCount = 0;
backup = -1; backup = -1;
for (; position < text.size(); ++position) for (; position < text.length(); ++position)
{ {
UChar ch = text[(UTextOffset)position]; UChar ch = text[(UTextOffset)position];
@ -1192,7 +1192,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
// Parse sign, if present // Parse sign, if present
bool_t negExp = FALSE; bool_t negExp = FALSE;
int32_t pos = position + 1; // position + exponentSep.length(); int32_t pos = position + 1; // position + exponentSep.length();
if (pos < text.size()) { if (pos < text.length()) {
ch = text[(UTextOffset) pos]; ch = text[(UTextOffset) pos];
if (ch == fSymbols->getPlusSign()) { if (ch == fSymbols->getPlusSign()) {
++pos; ++pos;
@ -1204,7 +1204,7 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
DigitList exponentDigits; DigitList exponentDigits;
exponentDigits.fCount = 0; exponentDigits.fCount = 0;
while (pos < text.size()) { while (pos < text.length()) {
digit = text[(UTextOffset) pos] - zero; digit = text[(UTextOffset) pos] - zero;
//~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~ //~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~~*~
// TEMPORARY WORKAROUND // TEMPORARY WORKAROUND
@ -1264,17 +1264,17 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
// check for positiveSuffix // check for positiveSuffix
if (gotPositive) if (gotPositive)
gotPositive = text.compare(position,fPositiveSuffix.size(),fPositiveSuffix,0, gotPositive = text.compare(position,fPositiveSuffix.length(),fPositiveSuffix,0,
fPositiveSuffix.size()) == 0; fPositiveSuffix.length()) == 0;
if (gotNegative) if (gotNegative)
gotNegative = text.compare(position,fNegativeSuffix.size(),fNegativeSuffix,0, gotNegative = text.compare(position,fNegativeSuffix.length(),fNegativeSuffix,0,
fNegativeSuffix.size()) == 0; fNegativeSuffix.length()) == 0;
// if both match, take longest // if both match, take longest
if (gotPositive && gotNegative) { if (gotPositive && gotNegative) {
if (fPositiveSuffix.size() > fNegativeSuffix.size()) if (fPositiveSuffix.length() > fNegativeSuffix.length())
gotNegative = FALSE; gotNegative = FALSE;
else if (fPositiveSuffix.size() < fNegativeSuffix.size()) else if (fPositiveSuffix.length() < fNegativeSuffix.length())
gotPositive = FALSE; gotPositive = FALSE;
} }
@ -1285,8 +1285,8 @@ bool_t DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePo
} }
parsePosition.setIndex(position + parsePosition.setIndex(position +
(gotPositive ? fPositiveSuffix.size() : (gotPositive ? fPositiveSuffix.length() :
fNegativeSuffix.size())); // mark success! fNegativeSuffix.length())); // mark success!
status[fgStatusPositive] = gotPositive; status[fgStatusPositive] = gotPositive;
@ -1781,7 +1781,7 @@ void DecimalFormat::expandAffixes() {
void DecimalFormat::expandAffix(const UnicodeString& pattern, void DecimalFormat::expandAffix(const UnicodeString& pattern,
UnicodeString& affix) const { UnicodeString& affix) const {
affix.remove(); affix.remove();
for (int i=0; i<pattern.size(); ) { for (int i=0; i<pattern.length(); ) {
UChar c = pattern.charAt(i++); UChar c = pattern.charAt(i++);
if (c == kQuote) { if (c == kQuote) {
c = pattern.charAt(i++); c = pattern.charAt(i++);
@ -1789,7 +1789,7 @@ void DecimalFormat::expandAffix(const UnicodeString& pattern,
case kCurrencySign: case kCurrencySign:
{ {
UnicodeString s; UnicodeString s;
if (i<pattern.size() && if (i<pattern.length() &&
pattern.charAt(i) == kCurrencySign) { pattern.charAt(i) == kCurrencySign) {
++i; ++i;
affix += fSymbols->getInternationalCurrencySymbol(s); affix += fSymbols->getInternationalCurrencySymbol(s);
@ -1839,11 +1839,11 @@ void DecimalFormat::appendAffix(UnicodeString& buffer,
appendAffix(buffer, expAffix, localized); appendAffix(buffer, expAffix, localized);
} else { } else {
int i; int i;
for (int pos=0; pos<affixPattern->size(); pos=i) { for (int pos=0; pos<affixPattern->length(); pos=i) {
i = affixPattern->indexOf(kQuote, pos); i = affixPattern->indexOf(kQuote, pos);
if (i < 0) { if (i < 0) {
UnicodeString s; UnicodeString s;
affixPattern->extractBetween(pos, affixPattern->size(), s); affixPattern->extractBetween(pos, affixPattern->length(), s);
appendAffix(buffer, s, localized); appendAffix(buffer, s, localized);
break; break;
} }
@ -1858,7 +1858,7 @@ void DecimalFormat::appendAffix(UnicodeString& buffer,
buffer.append(c); buffer.append(c);
// Fall through and append another kQuote below // Fall through and append another kQuote below
} else if (c == kCurrencySign && } else if (c == kCurrencySign &&
i<affixPattern->size() && i<affixPattern->length() &&
affixPattern->charAt(i) == kCurrencySign) { affixPattern->charAt(i) == kCurrencySign) {
++i; ++i;
buffer.append(c); buffer.append(c);
@ -1924,7 +1924,7 @@ DecimalFormat::appendAffix( UnicodeString& buffer,
if (affix.indexOf(0x0027 /*'\''*/) < 0) if (affix.indexOf(0x0027 /*'\''*/) < 0)
buffer += affix; buffer += affix;
else { else {
for (int32_t j = 0; j < affix.size(); ++j) { for (int32_t j = 0; j < affix.length(); ++j) {
UChar c = affix[j]; UChar c = affix[j];
buffer += c; buffer += c;
if (c == 0x0027 /*'\''*/) buffer += c; if (c == 0x0027 /*'\''*/) buffer += c;
@ -2171,7 +2171,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
int32_t start = pos; int32_t start = pos;
bool_t isPartDone = FALSE; bool_t isPartDone = FALSE;
for (; !isPartDone && pos < pattern.size(); ++pos) { for (; !isPartDone && pos < pattern.length(); ++pos) {
UChar ch = pattern[(UTextOffset) pos]; UChar ch = pattern[(UTextOffset) pos];
switch (subpart) { switch (subpart) {
case 0: // Pattern proper subpart (between prefix & suffix) case 0: // Pattern proper subpart (between prefix & suffix)
@ -2244,7 +2244,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
return; return;
} }
// Check for positive prefix // Check for positive prefix
if ((pos+1) < pattern.size() if ((pos+1) < pattern.length()
&& pattern[(UTextOffset) (pos+1)] == plus) { && pattern[(UTextOffset) (pos+1)] == plus) {
expSignAlways = TRUE; expSignAlways = TRUE;
++pos; ++pos;
@ -2252,7 +2252,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
// Use lookahead to parse out the exponential part of the // Use lookahead to parse out the exponential part of the
// pattern, then jump into suffix subpart. // pattern, then jump into suffix subpart.
expDigits = 0; expDigits = 0;
while (++pos < pattern.size() && while (++pos < pattern.length() &&
pattern[(UTextOffset) pos] == zeroDigit) { pattern[(UTextOffset) pos] == zeroDigit) {
++expDigits; ++expDigits;
} }
@ -2292,7 +2292,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
} else if (ch == kCurrencySign) { } else if (ch == kCurrencySign) {
// Use lookahead to determine if the currency sign is // Use lookahead to determine if the currency sign is
// doubled or not. // doubled or not.
bool_t doubled = (pos + 1) < pattern.size() && bool_t doubled = (pos + 1) < pattern.length() &&
pattern[(UTextOffset) (pos+1)] == kCurrencySign; pattern[(UTextOffset) (pos+1)] == kCurrencySign;
affix->append(kQuote); // Encode currency affix->append(kQuote); // Encode currency
if (doubled) { if (doubled) {
@ -2305,7 +2305,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
// A quote outside quotes indicates either the opening // A quote outside quotes indicates either the opening
// quote or two quotes, which is a quote literal. That is, // quote or two quotes, which is a quote literal. That is,
// we have the first quote in 'do' or o''clock. // we have the first quote in 'do' or o''clock.
if ((pos+1) < pattern.size() && if ((pos+1) < pattern.length() &&
pattern[(UTextOffset) (pos+1)] == kQuote) { pattern[(UTextOffset) (pos+1)] == kQuote) {
++pos; ++pos;
affix->append(kQuote); // Encode quote affix->append(kQuote); // Encode quote
@ -2345,7 +2345,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
// Fall through to append(ch) // Fall through to append(ch)
} else if (ch == padEscape) { } else if (ch == padEscape) {
if (padPos >= 0 || // Multiple pad specifiers if (padPos >= 0 || // Multiple pad specifiers
(pos+1) == pattern.size()) { // Nothing after padEscape (pos+1) == pattern.length()) { // Nothing after padEscape
debug("Multiple pad specifiers") debug("Multiple pad specifiers")
status = U_ILLEGAL_ARGUMENT_ERROR; status = U_ILLEGAL_ARGUMENT_ERROR;
return; return;
@ -2373,7 +2373,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
// quote or two quotes, which is a quote literal. That is, // quote or two quotes, which is a quote literal. That is,
// we have the second quote in 'do' or 'don''t'. // we have the second quote in 'do' or 'don''t'.
if (ch == kQuote) { if (ch == kQuote) {
if ((pos+1) < pattern.size() && if ((pos+1) < pattern.length() &&
pattern[(UTextOffset) (pos+1)] == kQuote) { pattern[(UTextOffset) (pos+1)] == kQuote) {
++pos; ++pos;
affix->append(kQuote); // Encode quote affix->append(kQuote); // Encode quote
@ -2389,11 +2389,11 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
} }
if (sub0Limit == 0) { if (sub0Limit == 0) {
sub0Limit = pattern.size(); sub0Limit = pattern.length();
} }
if (sub2Limit == 0) { if (sub2Limit == 0) {
sub2Limit = pattern.size(); sub2Limit = pattern.length();
} }
/* Handle patterns with no '0' pattern character. These patterns /* Handle patterns with no '0' pattern character. These patterns
@ -2513,7 +2513,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
} }
} }
if (pattern.size() == 0) { if (pattern.length() == 0) {
delete fNegPrefixPattern; delete fNegPrefixPattern;
delete fNegSuffixPattern; delete fNegSuffixPattern;
fNegPrefixPattern = NULL; fNegPrefixPattern = NULL;

View File

@ -160,7 +160,7 @@ MergeCollation::getPattern(UnicodeString& result, bool_t withWhiteSpace) const
{ {
// if the entry is an expanding ligature, queue up the entries until // if the entry is an expanding ligature, queue up the entries until
// the last same ligature has been processed. // the last same ligature has been processed.
if (entry->extension.size() != 0) if (entry->extension.length() != 0)
{ {
if (extList == NULL) if (extList == NULL)
{ {
@ -268,7 +268,7 @@ void MergeCollation::addPattern(const UnicodeString& pattern,
Normalizer::EMode decompMode, Normalizer::EMode decompMode,
UErrorCode& success) UErrorCode& success)
{ {
if (U_FAILURE(success) || (pattern.size() == 0)) if (U_FAILURE(success) || (pattern.length() == 0))
{ {
return; return;
} }
@ -319,7 +319,7 @@ const PatternEntry* MergeCollation::getItemAt(UTextOffset index) const {
const PatternEntry* MergeCollation::findLastWithNoExtension(int32_t i) const { const PatternEntry* MergeCollation::findLastWithNoExtension(int32_t i) const {
for (--i;i >= 0; --i) { for (--i;i >= 0; --i) {
PatternEntry* entry = patterns->at(i); PatternEntry* entry = patterns->at(i);
if ((entry != 0) && (entry->extension.size() == 0)) { if ((entry != 0) && (entry->extension.length() == 0)) {
return entry; return entry;
} }
} }
@ -350,7 +350,7 @@ void MergeCollation::fixEntry(PatternEntry* newEntry,
// replace the previous one. This will improve the single // replace the previous one. This will improve the single
// char entries dramatically which is the majority of the // char entries dramatically which is the majority of the
// entries. // entries.
if (newEntry->chars.size() == 1) if (newEntry->chars.length() == 1)
{ {
UChar c = newEntry->chars[0]; UChar c = newEntry->chars[0];
int32_t statusIndex = c >> BYTEPOWER; int32_t statusIndex = c >> BYTEPOWER;
@ -401,7 +401,7 @@ void MergeCollation::fixEntry(PatternEntry* newEntry,
} }
// Do not change the last entry if the new entry is a expanding character // Do not change the last entry if the new entry is a expanding character
if (excess.size() != 0) if (excess.length() != 0)
{ {
// newEntry.extension = excess + newEntry.extensions; // newEntry.extension = excess + newEntry.extensions;
newEntry->extension.insert(0, excess); newEntry->extension.insert(0, excess);
@ -451,7 +451,7 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry,
// If the last entry is a single char entry and has been installed, // If the last entry is a single char entry and has been installed,
// that means the last index is the real last index. // that means the last index is the real last index.
if (lastEntry->chars.size() == 1) if (lastEntry->chars.length() == 1)
{ {
int32_t index = lastEntry->chars[0] >> BYTEPOWER; int32_t index = lastEntry->chars[0] >> BYTEPOWER;
@ -497,11 +497,11 @@ MergeCollation::findLastEntry(const PatternEntry* lastEntry,
// be 'Q'. We save the characters that didn't match ("uestion-mark" in // be 'Q'. We save the characters that didn't match ("uestion-mark" in
// this case), and then return the next index. // this case), and then return the next index.
// //
if (entry->chars.compareBetween(0, entry->chars.size(), if (entry->chars.compareBetween(0, entry->chars.length(),
lastEntry->chars,0,entry->chars.size()) == 0) lastEntry->chars,0,entry->chars.length()) == 0)
{ {
lastEntry->chars.extractBetween(entry->chars.size(), lastEntry->chars.extractBetween(entry->chars.length(),
lastEntry->chars.size(), lastEntry->chars.length(),
buffer); buffer);
excess += buffer; excess += buffer;
break; break;

View File

@ -220,11 +220,11 @@ MessageFormat::applyPattern(const UnicodeString& newPattern,
bool_t inQuote = FALSE; bool_t inQuote = FALSE;
int32_t braceStack = 0; int32_t braceStack = 0;
fMaxOffset = -1; fMaxOffset = -1;
for (int i = 0; i < newPattern.size(); ++i) { for (int i = 0; i < newPattern.length(); ++i) {
UChar ch = newPattern[i]; UChar ch = newPattern[i];
if (part == 0) { if (part == 0) {
if (ch == 0x0027 /*'\''*/) { if (ch == 0x0027 /*'\''*/) {
if (i + 1 < newPattern.size() if (i + 1 < newPattern.length()
&& newPattern[i+1] == 0x0027 /*'\''*/) { && newPattern[i+1] == 0x0027 /*'\''*/) {
segments[part] += ch; // handle doubles segments[part] += ch; // handle doubles
++i; ++i;
@ -402,7 +402,7 @@ MessageFormat::toPattern(UnicodeString& result) const
} }
result += 0x007D /*'}'*/; result += 0x007D /*'}'*/;
} }
copyAndFixQuotes(fPattern, lastOffset, fPattern.size(), result); copyAndFixQuotes(fPattern, lastOffset, fPattern.length(), result);
return result; return result;
} }
@ -661,7 +661,7 @@ MessageFormat::format(const Formattable* arguments,
} }
buffer.remove(); buffer.remove();
// Appends the rest of the pattern characters after the real last offset. // Appends the rest of the pattern characters after the real last offset.
fPattern.extract(lastOffset, fPattern.size(), buffer); fPattern.extract(lastOffset, fPattern.length(), buffer);
result += buffer; result += buffer;
return result; return result;
} }
@ -724,11 +724,11 @@ MessageFormat::parse(const UnicodeString& source,
// if at end, use longest possible match // if at end, use longest possible match
// otherwise uses first match to intervening string // otherwise uses first match to intervening string
// does NOT recursively try all possibilities // does NOT recursively try all possibilities
int32_t tempLength = (i != fMaxOffset) ? fOffsets[i+1] : fPattern.size(); int32_t tempLength = (i != fMaxOffset) ? fOffsets[i+1] : fPattern.length();
int32_t next; int32_t next;
if (patternOffset >= tempLength) { if (patternOffset >= tempLength) {
next = source.size(); next = source.length();
} }
else { else {
UnicodeString buffer; UnicodeString buffer;
@ -777,7 +777,7 @@ MessageFormat::parse(const UnicodeString& source,
sourceOffset = tempStatus.getIndex(); // update sourceOffset = tempStatus.getIndex(); // update
} }
} }
int32_t len = fPattern.size() - patternOffset; int32_t len = fPattern.length() - patternOffset;
if (len == 0 || if (len == 0 ||
fPattern.compare(patternOffset, len, source, sourceOffset, len) == 0) { fPattern.compare(patternOffset, len, source, sourceOffset, len) == 0) {
status.setIndex(sourceOffset + len); status.setIndex(sourceOffset + len);
@ -948,7 +948,7 @@ MessageFormat::makeFormat(int32_t position,
return; return;
} }
fMaxOffset = offsetNumber; fMaxOffset = offsetNumber;
fOffsets[offsetNumber] = segments[0].size(); fOffsets[offsetNumber] = segments[0].length();
fArgumentNumbers[offsetNumber] = argumentNumber; fArgumentNumbers[offsetNumber] = argumentNumber;
// now get the format // now get the format

View File

@ -140,7 +140,7 @@ void PatternEntry::addToBuffer(UnicodeString& toAddTo,
bool_t showWhiteSpace, bool_t showWhiteSpace,
const PatternEntry* lastEntry) const const PatternEntry* lastEntry) const
{ {
if (showWhiteSpace && toAddTo.size() > 0) if (showWhiteSpace && toAddTo.length() > 0)
// Adds new line before each primary strength entry. // Adds new line before each primary strength entry.
if (strength == Collator::PRIMARY || lastEntry != NULL) if (strength == Collator::PRIMARY || lastEntry != NULL)
toAddTo += 0x000A/*'\n'*/; toAddTo += 0x000A/*'\n'*/;
@ -169,7 +169,7 @@ void PatternEntry::addToBuffer(UnicodeString& toAddTo,
appendQuoted(chars,toAddTo); appendQuoted(chars,toAddTo);
// If there's an expending char and needs to be shown, // If there's an expending char and needs to be shown,
// append that after the entry // append that after the entry
if (showExtension && extension.size() != 0) { if (showExtension && extension.length() != 0) {
toAddTo += 0x002F/*'/'*/; toAddTo += 0x002F/*'/'*/;
appendQuoted(extension,toAddTo); appendQuoted(extension,toAddTo);
} }
@ -249,7 +249,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
newChars.remove(); newChars.remove();
newExtensions.remove(); newExtensions.remove();
while (index < pattern.size()) while (index < pattern.length())
{ {
UChar ch = pattern[index]; UChar ch = pattern[index];
@ -261,7 +261,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
} }
else else
{ {
if ((newChars.size() == 0) || inChars) if ((newChars.length() == 0) || inChars)
{ {
newChars += ch; newChars += ch;
} }
@ -338,7 +338,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
inQuote = TRUE; inQuote = TRUE;
ch = pattern[++index]; ch = pattern[++index];
if (newChars.size() == 0) if (newChars.length() == 0)
{ {
newChars += ch; newChars += ch;
} }
@ -394,7 +394,7 @@ PatternEntry *PatternEntry::Parser::next(UErrorCode &status)
return NULL; return NULL;
} }
if (newChars.size() == 0) if (newChars.length() == 0)
{ {
status = U_INVALID_FORMAT_ERROR; status = U_INVALID_FORMAT_ERROR;
return NULL; return NULL;

View File

@ -404,19 +404,19 @@ SimpleDateFormat::format(UDate date, UnicodeString& toAppendTo, FieldPosition& p
UnicodeString str; UnicodeString str;
// loop through the pattern string character by character // loop through the pattern string character by character
for (int32_t i = 0; i < fPattern.size() && U_SUCCESS(status); ++i) { for (int32_t i = 0; i < fPattern.length() && U_SUCCESS(status); ++i) {
UChar ch = fPattern[i]; UChar ch = fPattern[i];
// Use subFormat() to format a repeated pattern character // Use subFormat() to format a repeated pattern character
// when a different pattern or non-pattern character is seen // when a different pattern or non-pattern character is seen
if (ch != prevCh && count > 0) { if (ch != prevCh && count > 0) {
toAppendTo += subFormat(str, prevCh, count, toAppendTo.size(), pos, status); toAppendTo += subFormat(str, prevCh, count, toAppendTo.length(), pos, status);
count = 0; count = 0;
} }
if (ch == 0x0027 /*'\''*/) { if (ch == 0x0027 /*'\''*/) {
// Consecutive single quotes are a single quote literal, // Consecutive single quotes are a single quote literal,
// either outside of quotes or between quotes // either outside of quotes or between quotes
if ((i+1) < fPattern.size() && fPattern[i+1] == 0x0027 /*'\''*/) { if ((i+1) < fPattern.length() && fPattern[i+1] == 0x0027 /*'\''*/) {
toAppendTo += 0x0027 /*'\''*/; toAppendTo += 0x0027 /*'\''*/;
++i; ++i;
} else { } else {
@ -438,7 +438,7 @@ SimpleDateFormat::format(UDate date, UnicodeString& toAppendTo, FieldPosition& p
// Format the last item in the pattern, if any // Format the last item in the pattern, if any
if (count > 0) { if (count > 0) {
toAppendTo += subFormat(str, prevCh, count, toAppendTo.size(), pos, status); toAppendTo += subFormat(str, prevCh, count, toAppendTo.length(), pos, status);
} }
// and if something failed (e.g., an invalid format character), reset our FieldPosition // and if something failed (e.g., an invalid format character), reset our FieldPosition
@ -659,7 +659,7 @@ SimpleDateFormat::subFormat(UnicodeString& result,
if (pos.getField() == fgPatternIndexToDateFormatField[patternCharIndex]) { if (pos.getField() == fgPatternIndexToDateFormatField[patternCharIndex]) {
if (pos.getBeginIndex() == 0 && pos.getEndIndex() == 0) { if (pos.getBeginIndex() == 0 && pos.getEndIndex() == 0) {
pos.setBeginIndex(beginOffset); pos.setBeginIndex(beginOffset);
pos.setEndIndex(beginOffset + result.size()); pos.setEndIndex(beginOffset + result.length());
} }
} }
@ -730,7 +730,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
// loop through the pattern string character by character, using it to control how // loop through the pattern string character by character, using it to control how
// we match characters in the input // we match characters in the input
for (int32_t i = 0; i < fPattern.size();++i) { for (int32_t i = 0; i < fPattern.length();++i) {
UChar ch = fPattern[i]; UChar ch = fPattern[i];
// if we're inside a quoted string, match characters exactly until we hit // if we're inside a quoted string, match characters exactly until we hit
@ -746,7 +746,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
// a quote literal we need to match. // a quote literal we need to match.
if (count == 0) if (count == 0)
{ {
if(start > text.size() || ch != text[start]) if(start > text.length() || ch != text[start])
{ {
pos.setIndex(oldStart); pos.setIndex(oldStart);
pos.setErrorIndex(start); pos.setErrorIndex(start);
@ -761,7 +761,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
else else
{ {
// pattern uses text following from 1st single quote. // pattern uses text following from 1st single quote.
if (start >= text.size() || ch != text[start]) { if (start >= text.length() || ch != text[start]) {
// Check for cases like: 'at' in pattern vs "xt" // Check for cases like: 'at' in pattern vs "xt"
// in time text, where 'a' doesn't match with 'x'. // in time text, where 'a' doesn't match with 'x'.
// If fail to match, return null. // If fail to match, return null.
@ -801,7 +801,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
// for example, 'o''clock'. We need to parse this as // for example, 'o''clock'. We need to parse this as
// representing a single quote within the quote. // representing a single quote within the quote.
int32_t startOffset = start; int32_t startOffset = start;
if (start >= text.size() || ch != text[start]) if (start >= text.length() || ch != text[start])
{ {
pos.setErrorIndex(startOffset); pos.setErrorIndex(startOffset);
pos.setIndex(oldStart); pos.setIndex(oldStart);
@ -857,7 +857,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
// {sfb} correct Date? // {sfb} correct Date?
return 0; return 0;
} }
if (start >= text.size() || ch != text[start]) { if (start >= text.length() || ch != text[start]) {
// handle cases like: 'MMMM dd' in pattern vs. "janx20" // handle cases like: 'MMMM dd' in pattern vs. "janx20"
// in time text, where ' ' doesn't match with 'x'. // in time text, where ' ' doesn't match with 'x'.
pos.setErrorIndex(start); pos.setErrorIndex(start);
@ -873,7 +873,7 @@ SimpleDateFormat::parse(const UnicodeString& text, ParsePosition& pos) const
// otherwise, match characters exactly // otherwise, match characters exactly
else else
{ {
if (start >= text.size() || ch != text[start]) { if (start >= text.length() || ch != text[start]) {
// handle cases like: 'MMMM dd' in pattern vs. // handle cases like: 'MMMM dd' in pattern vs.
// "jan,,,20" in time text, where " " doesn't // "jan,,,20" in time text, where " " doesn't
// match with ",,,". // match with ",,,".
@ -997,7 +997,7 @@ int32_t SimpleDateFormat::matchString(const UnicodeString& text,
for (; i < count; ++i) for (; i < count; ++i)
{ {
int32_t length = data[i].size(); int32_t length = data[i].length();
// Always compare if we have no match yet; otherwise only compare // Always compare if we have no match yet; otherwise only compare
// against potentially better matches (longer strings). // against potentially better matches (longer strings).
@ -1082,7 +1082,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// If there are any spaces here, skip over them. If we hit the end // If there are any spaces here, skip over them. If we hit the end
// of the string, then fail. // of the string, then fail.
for (;;) { for (;;) {
if (pos.getIndex() >= text.size()) if (pos.getIndex() >= text.length())
return -start; return -start;
UChar c = text[pos.getIndex()]; UChar c = text[pos.getIndex()];
if (c != 0x0020 /*' '*/ && c != 0x0009 /*'\t'*/) if (c != 0x0020 /*' '*/ && c != 0x0009 /*'\t'*/)
@ -1104,7 +1104,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// but that's going to be difficult. // but that's going to be difficult.
if (obeyCount) if (obeyCount)
{ {
if ((start+count) > text.size()) if ((start+count) > text.length())
return -start; return -start;
UnicodeString temp; UnicodeString temp;
text.extractBetween(0, start + count, temp); text.extractBetween(0, start + count, temp);
@ -1216,12 +1216,12 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
UnicodeString lcaseGMT(fgGmt); UnicodeString lcaseGMT(fgGmt);
lcaseGMT.toLower(); lcaseGMT.toLower();
if ((text.size() - start) > fgGmt.size() && if ((text.length() - start) > fgGmt.length() &&
(lcaseText.compare(start, lcaseGMT.size(), lcaseGMT, 0, lcaseGMT.size())) == 0) (lcaseText.compare(start, lcaseGMT.length(), lcaseGMT, 0, lcaseGMT.length())) == 0)
{ {
fCalendar->set(Calendar::DST_OFFSET, 0); fCalendar->set(Calendar::DST_OFFSET, 0);
pos.setIndex(start + fgGmt.size()); pos.setIndex(start + fgGmt.length());
if( text[pos.getIndex()] == 0x002B /*'+'*/ ) if( text[pos.getIndex()] == 0x002B /*'+'*/ )
sign = 1; sign = 1;
@ -1285,7 +1285,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
UnicodeString s2(fSymbols->fZoneStrings[i][j]); UnicodeString s2(fSymbols->fZoneStrings[i][j]);
s2.toLower(); s2.toLower();
if ((s1.compare(start, s2.size(), s2, 0, s2.size())) == 0) if ((s1.compare(start, s2.length(), s2, 0, s2.length())) == 0)
break; break;
} }
if (j <= 4) if (j <= 4)
@ -1296,7 +1296,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// use the correct DST SAVINGS for the zone. // use the correct DST SAVINGS for the zone.
delete tz; delete tz;
fCalendar->set(Calendar::DST_OFFSET, j >= 3 ? U_MILLIS_PER_HOUR : 0); fCalendar->set(Calendar::DST_OFFSET, j >= 3 ? U_MILLIS_PER_HOUR : 0);
return (start + fSymbols->fZoneStrings[i][j].size()); return (start + fSymbols->fZoneStrings[i][j].length());
} }
} }
@ -1367,7 +1367,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
// Handle "generic" fields // Handle "generic" fields
if (obeyCount) if (obeyCount)
{ {
if ((start+count) > text.size()) if ((start+count) > text.length())
return -start; return -start;
UnicodeString s; UnicodeString s;
// {sfb} old code had extract, make sure it works // {sfb} old code had extract, make sure it works
@ -1404,7 +1404,7 @@ void SimpleDateFormat::translatePattern(const UnicodeString& originalPattern,
translatedPattern.remove(); translatedPattern.remove();
bool_t inQuote = FALSE; bool_t inQuote = FALSE;
for (UTextOffset i = 0; i < originalPattern.size(); ++i) { for (UTextOffset i = 0; i < originalPattern.length(); ++i) {
UChar c = originalPattern[i]; UChar c = originalPattern[i];
if (inQuote) { if (inQuote) {
if (c == 0x0027 /*'\''*/) if (c == 0x0027 /*'\''*/)

View File

@ -229,7 +229,7 @@ int32_t
CollationKey::storeUnicodeString(int32_t cursor, const UnicodeString &value) CollationKey::storeUnicodeString(int32_t cursor, const UnicodeString &value)
{ {
UTextOffset input = 0; UTextOffset input = 0;
int32_t charCount = value.size(); int32_t charCount = value.length();
while (input < charCount) while (input < charCount)
{ {
@ -242,7 +242,7 @@ CollationKey::storeUnicodeString(int32_t cursor, const UnicodeString &value)
CollationKey& CollationKey&
CollationKey::copyUnicodeString(const UnicodeString &value) CollationKey::copyUnicodeString(const UnicodeString &value)
{ {
int32_t charCount = value.size(); int32_t charCount = value.length();
// We allocate enough space for two null bytes at the end. // We allocate enough space for two null bytes at the end.
ensureCapacity((charCount * 2) + 2); ensureCapacity((charCount * 2) + 2);

View File

@ -553,7 +553,7 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale,
for (;;) for (;;)
{ {
if (localeName.size() == 0) if (localeName.length() == 0)
{ {
if (next == eDone) if (next == eDone)
{ {
@ -949,8 +949,8 @@ RuleBasedCollator::compare( const UnicodeString& source,
UnicodeString target_togo; UnicodeString target_togo;
UTextOffset begin=0; UTextOffset begin=0;
source.extract(begin, icu_min(length,source.size()), source_togo); source.extract(begin, icu_min(length,source.length()), source_togo);
target.extract(begin, icu_min(length,target.size()), target_togo); target.extract(begin, icu_min(length,target.length()), target_togo);
return (RuleBasedCollator::compare(source_togo, target_togo)); return (RuleBasedCollator::compare(source_togo, target_togo));
} }
@ -1362,7 +1362,7 @@ RuleBasedCollator::getCollationKey( const UnicodeString& source,
CollationKey& sortkey, CollationKey& sortkey,
UErrorCode& status) const UErrorCode& status) const
{ {
return RuleBasedCollator::getCollationKey(source.getUChars(), source.size(), sortkey, status); return RuleBasedCollator::getCollationKey(source.getUChars(), source.length(), sortkey, status);
} }
CollationKey& CollationKey&
@ -1466,7 +1466,7 @@ RuleBasedCollator::getCollationKey( const UChar* source,
if (U_SUCCESS(status)) if (U_SUCCESS(status))
{ {
totalIdent = decomp.size() + 1; totalIdent = decomp.length() + 1;
} }
} }
@ -1607,7 +1607,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
UnicodeString expChars; UnicodeString expChars;
UnicodeString groupChars; UnicodeString groupChars;
if (pattern.size() == 0) if (pattern.length() == 0)
{ {
status = U_INVALID_FORMAT_ERROR; status = U_INVALID_FORMAT_ERROR;
return; return;
@ -1645,16 +1645,16 @@ RuleBasedCollator::build(const UnicodeString& pattern,
entry->getChars(groupChars); entry->getChars(groupChars);
// check if french secondary needs to be turned on // check if french secondary needs to be turned on
if ((groupChars.size() > 1) && if ((groupChars.length() > 1) &&
(groupChars[groupChars.size()-(T_INT32(1))] == 0x0040)) (groupChars[groupChars.length()-(T_INT32(1))] == 0x0040))
{ {
data->isFrenchSec = TRUE; data->isFrenchSec = TRUE;
groupChars.remove(groupChars.size()-(T_INT32(1))); groupChars.remove(groupChars.length()-(T_INT32(1)));
} }
order = increment((Collator::ECollationStrength)entry->getStrength(), order); order = increment((Collator::ECollationStrength)entry->getStrength(), order);
if (entry->getExtension(expChars).size() != 0) if (entry->getExtension(expChars).length() != 0)
{ {
// encountered an expanding character, where one character on input // encountered an expanding character, where one character on input
// expands to several sort elements (e.g. 'ö' --> 'o' 'e') // expands to several sort elements (e.g. 'ö' --> 'o' 'e')
@ -1664,7 +1664,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
return; return;
} }
} }
else if (groupChars.size() > 1) else if (groupChars.length() > 1)
{ {
// encountered a contracting character, where several characters on input // encountered a contracting character, where several characters on input
// contract into one sort order. For example, "ch" is treated as a single // contract into one sort order. For example, "ch" is treated as a single
@ -1750,7 +1750,7 @@ RuleBasedCollator::build(const UnicodeString& pattern,
bool_t allThere = TRUE; bool_t allThere = TRUE;
int32_t i; int32_t i;
for (i = 0; i < decomp.size(); i += 1) for (i = 0; i < decomp.length(); i += 1)
{ {
if (getCharOrder(decomp[i]) == UNMAPPED) if (getCharOrder(decomp[i]) == UNMAPPED)
{ {
@ -1914,7 +1914,7 @@ RuleBasedCollator::addExpandOrder( const UnicodeString& contractChars,
int32_t tableIndex = addExpansion(anOrder, expandChars); int32_t tableIndex = addExpansion(anOrder, expandChars);
// And add its index into the main mapping table // And add its index into the main mapping table
if (contractChars.size() > 1) if (contractChars.length() > 1)
{ {
addContractOrder(contractChars, tableIndex, status); addContractOrder(contractChars, tableIndex, status);
} }
@ -1939,7 +1939,7 @@ int32_t RuleBasedCollator::addExpansion(int32_t anOrder, const UnicodeString &ex
// If anOrder is valid, we want to add it at the beginning of the list // If anOrder is valid, we want to add it at the beginning of the list
int32_t offset = (anOrder == UNMAPPED) ? 0 : 1; int32_t offset = (anOrder == UNMAPPED) ? 0 : 1;
VectorOfInt *valueList = new VectorOfInt(expandChars.size() + offset); VectorOfInt *valueList = new VectorOfInt(expandChars.length() + offset);
if (offset == 1) if (offset == 1)
{ {
@ -1947,7 +1947,7 @@ int32_t RuleBasedCollator::addExpansion(int32_t anOrder, const UnicodeString &ex
} }
int32_t i; int32_t i;
for (i = 0; i < expandChars.size(); i += 1) for (i = 0; i < expandChars.length(); i += 1)
{ {
UChar ch = expandChars[i]; UChar ch = expandChars[i];
int32_t mapValue = getCharOrder(ch); int32_t mapValue = getCharOrder(ch);
@ -2140,7 +2140,7 @@ RuleBasedCollator::hashCode() const
{ {
int32_t value = 0; int32_t value = 0;
int32_t c; int32_t c;
int32_t count = getRules().size(); int32_t count = getRules().length();
UTextOffset pos = count - 1; UTextOffset pos = count - 1;
if (count > 64) if (count > 64)
@ -2410,7 +2410,7 @@ RuleBasedCollator::createPathName( const UnicodeString& prefix,
workingName += name; workingName += name;
workingName += suffix; workingName += suffix;
size = workingName.size(); size = workingName.length();
returnVal = new char[size + 1]; returnVal = new char[size + 1];
workingName.extract(0, size, returnVal, ""); workingName.extract(0, size, returnVal, "");
returnVal[size] = 0; returnVal[size] = 0;
@ -2425,7 +2425,7 @@ RuleBasedCollator::chopLocale(UnicodeString& localeName)
// For instance, "de_CH" becomes "de", and "de" becomes "". // For instance, "de_CH" becomes "de", and "de" becomes "".
// "" remains "". // "" remains "".
int32_t size = localeName.size(); int32_t size = localeName.length();
int32_t i; int32_t i;
for (i = size - 1; i > 0; i--) for (i = size - 1; i > 0; i--)

View File

@ -537,7 +537,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
UnicodeString idUppercase = id; UnicodeString idUppercase = id;
idUppercase.toUpper(); idUppercase.toUpper();
if (id.size() > GMT_ID_LENGTH && if (id.length() > GMT_ID_LENGTH &&
idUppercase.startsWith(GMT_ID)) idUppercase.startsWith(GMT_ID))
{ {
ParsePosition pos(GMT_ID_LENGTH); ParsePosition pos(GMT_ID_LENGTH);
@ -564,7 +564,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
if (pos.getIndex() == start) return 0; if (pos.getIndex() == start) return 0;
offset = n.getLong(); offset = n.getLong();
if (pos.getIndex() < id.size() && if (pos.getIndex() < id.length() &&
id[pos.getIndex()] == 0x003A /*':'*/) id[pos.getIndex()] == 0x003A /*':'*/)
{ {
// hh:mm // hh:mm

View File

@ -271,7 +271,7 @@ ucol_getRules( const UCollator *coll,
int32_t *length) int32_t *length)
{ {
const UnicodeString& rules = ((RuleBasedCollator*)coll)->getRules(); const UnicodeString& rules = ((RuleBasedCollator*)coll)->getRules();
*length = rules.size(); *length = rules.length();
return rules.getUChars(); return rules.getUChars();
} }

View File

@ -51,10 +51,10 @@ findKeyword(const UnicodeString& s,
// If so, the string contains a modifier, and we only want to // If so, the string contains a modifier, and we only want to
// parse the type // parse the type
int32_t commaPos = buffer.indexOf(0x002C); int32_t commaPos = buffer.indexOf(0x002C);
commaPos = (commaPos == -1 ? buffer.size() : commaPos); commaPos = (commaPos == -1 ? buffer.length() : commaPos);
buffer.truncate(commaPos); buffer.truncate(commaPos);
if(buffer == list[i]) { if(buffer == list[i]) {
kwLen = list[i].size(); kwLen = list[i].length();
return i; return i;
} }
} }

View File

@ -538,12 +538,12 @@ unum_getSymbols(const UNumberFormat* fmt,
syms->minusSign = dfs->getMinusSign(); syms->minusSign = dfs->getMinusSign();
dfs->getCurrencySymbol(temp); dfs->getCurrencySymbol(temp);
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE); len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->currency, temp.getUChars(), len); u_strncpy(syms->currency, temp.getUChars(), len);
syms->currency[len > 0 ? len + 1 : 0] = 0x0000; syms->currency[len > 0 ? len + 1 : 0] = 0x0000;
dfs->getInternationalCurrencySymbol(temp); dfs->getInternationalCurrencySymbol(temp);
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE); len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->intlCurrency, temp.getUChars(), len); u_strncpy(syms->intlCurrency, temp.getUChars(), len);
syms->intlCurrency[len > 0 ? len + 1 : 0] = 0x0000; syms->intlCurrency[len > 0 ? len + 1 : 0] = 0x0000;
@ -553,12 +553,12 @@ unum_getSymbols(const UNumberFormat* fmt,
syms->padEscape = dfs->getPadEscape(); syms->padEscape = dfs->getPadEscape();
dfs->getInfinity(temp); dfs->getInfinity(temp);
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE); len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->infinity, temp.getUChars(), len); u_strncpy(syms->infinity, temp.getUChars(), len);
syms->infinity[len > 0 ? len + 1 : 0] = 0x0000; syms->infinity[len > 0 ? len + 1 : 0] = 0x0000;
dfs->getNaN(temp); dfs->getNaN(temp);
len = icu_min(temp.size(), UNFSYMBOLSMAXSIZE); len = icu_min(temp.length(), UNFSYMBOLSMAXSIZE);
u_strncpy(syms->naN, temp.getUChars(), len); u_strncpy(syms->naN, temp.getUChars(), len);
syms->naN[len > 0 ? len + 1 : 0] = 0x0000; syms->naN[len > 0 ? len + 1 : 0] = 0x0000;
} }

View File

@ -129,7 +129,7 @@ CollationAPITest::TestProperty( char* par )
logln("Default collation property test ended."); logln("Default collation property test ended.");
logln("Collator::getRules() testing ..."); logln("Collator::getRules() testing ...");
doAssert(((RuleBasedCollator*)col)->getRules().size() != 0, "getRules() result incorrect" ); doAssert(((RuleBasedCollator*)col)->getRules().length() != 0, "getRules() result incorrect" );
logln("getRules tests end."); logln("getRules tests end.");
delete col; col = 0; delete col; col = 0;

View File

@ -89,12 +89,12 @@ void CharIterTest::TestIteration() {
c = iter.first(); c = iter.first();
i = 0; i = 0;
if (iter.startIndex() != 0 || iter.endIndex() != text.size()) if (iter.startIndex() != 0 || iter.endIndex() != text.length())
errln("startIndex() or endIndex() failed"); errln("startIndex() or endIndex() failed");
logln("Testing forward iteration..."); logln("Testing forward iteration...");
do { do {
if (c == CharacterIterator::DONE && i != text.size()) if (c == CharacterIterator::DONE && i != text.length())
errln("Iterator reached end prematurely"); errln("Iterator reached end prematurely");
else if (c != text[i]) else if (c != text[i])
errln((UnicodeString)"Character mismatch at position " + i + errln((UnicodeString)"Character mismatch at position " + i +
@ -113,7 +113,7 @@ void CharIterTest::TestIteration() {
} while (c != CharacterIterator::DONE); } while (c != CharacterIterator::DONE);
c = iter.last(); c = iter.last();
i = text.size() - 1; i = text.length() - 1;
logln("Testing backward iteration..."); logln("Testing backward iteration...");
do { do {

View File

@ -477,7 +477,7 @@ void ConvertTest::TestConvert()
logln("\n---Testing UChar* RoundTrip ..."); logln("\n---Testing UChar* RoundTrip ...");
// uniString3->remove(); // uniString3->remove();
uniString3->replace(0, uniString3->size(), my_ucs_file_buffer, i); uniString3->replace(0, uniString3->length(), my_ucs_file_buffer, i);
//uniString3 = new UnicodeString(my_ucs_file_buffer,i); //uniString3 = new UnicodeString(my_ucs_file_buffer,i);
/*checks if Uni1 == Uni3*/ /*checks if Uni1 == Uni3*/
@ -499,7 +499,7 @@ void ConvertTest::TestConvert()
SJIS.toUnicodeString(myString, mySJIS, 12, err); SJIS.toUnicodeString(myString, mySJIS, 12, err);
if (U_FAILURE(err)||(myString.size()!=10)) errln("toUnicodeString test failed"); if (U_FAILURE(err)||(myString.length()!=10)) errln("toUnicodeString test failed");
else logln("toUnicodeString test ok"); else logln("toUnicodeString test ok");
fclose(ucs_file_in); fclose(ucs_file_in);
@ -516,7 +516,7 @@ void ConvertTest::TestConvert()
void WriteToFile(const UnicodeString *a, FILE *myfile) void WriteToFile(const UnicodeString *a, FILE *myfile)
{ {
uint32_t size = a->size(); uint32_t size = a->length();
uint16_t i = 0; uint16_t i = 0;
UChar b = 0xFEFF; UChar b = 0xFEFF;

View File

@ -189,7 +189,7 @@ void DateFormatRegressionTest::Test4052408()
pos.getBeginIndex() + ", " + pos.getBeginIndex() + ", " +
pos.getEndIndex()); pos.getEndIndex());
UnicodeString exp = expected[i]; UnicodeString exp = expected[i];
if((exp.size() == 0 && str.size() == 0) || str == exp) if((exp.length() == 0 && str.length() == 0) || str == exp)
logln(" ok"); logln(" ok");
else { else {
logln(UnicodeString(" expected ") + exp); logln(UnicodeString(" expected ") + exp);

View File

@ -305,7 +305,7 @@ int32_t DateFormatRoundTripTest::getField(UDate d, int32_t f) {
UnicodeString& DateFormatRoundTripTest::escape(const UnicodeString& src, UnicodeString& dst ) UnicodeString& DateFormatRoundTripTest::escape(const UnicodeString& src, UnicodeString& dst )
{ {
dst.remove(); dst.remove();
for (int32_t i = 0; i < src.size(); ++i) { for (int32_t i = 0; i < src.length(); ++i) {
UChar c = src[i]; UChar c = src[i];
if(c < 0x0080) if(c < 0x0080)
dst += c; dst += c;

View File

@ -114,7 +114,7 @@ void DateFormatTest::TestWallyWedel()
{ {
//fmtDstOffset = fmtOffset->substring(3); //fmtDstOffset = fmtOffset->substring(3);
fmtDstOffset = new UnicodeString(); fmtDstOffset = new UnicodeString();
fmtOffset.extract(3, fmtOffset.size(), *fmtDstOffset); fmtOffset.extract(3, fmtOffset.length(), *fmtDstOffset);
} }
/* /*
* Show our result. * Show our result.
@ -193,7 +193,7 @@ UnicodeString&
DateFormatTest::escape(UnicodeString& s) DateFormatTest::escape(UnicodeString& s)
{ {
UnicodeString buf; UnicodeString buf;
for (int32_t i=0; i<s.size(); ++i) for (int32_t i=0; i<s.length(); ++i)
{ {
UChar c = s[(UTextOffset)i]; UChar c = s[(UTextOffset)i];
if (c <= (UChar)0x7F) buf += c; if (c <= (UChar)0x7F) buf += c;
@ -579,7 +579,7 @@ DateFormatTest::TestQuotePattern161()
UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString); UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString);
UnicodeString exp("08/13/1997 at 10:42:28 AM "); UnicodeString exp("08/13/1997 at 10:42:28 AM ");
logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString); logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString);
if (0 != dateString.compareBetween(0, exp.size(), exp, 0, exp.size())) errln((UnicodeString)"FAIL: Expected " + exp); if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp);
delete formatter; delete formatter;
if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
} }
@ -621,7 +621,7 @@ DateFormatTest::TestBadInput135()
{ {
UnicodeString format; full->format(when, format); UnicodeString format; full->format(when, format);
logln(prefix + "OK: " + format); logln(prefix + "OK: " + format);
if (0!=format.compareBetween(0, expected.size(), expected, 0, expected.size())) if (0!=format.compareBetween(0, expected.length(), expected, 0, expected.length()))
errln((UnicodeString)"FAIL: Expected " + expected); errln((UnicodeString)"FAIL: Expected " + expected);
} }
//} //}
@ -708,7 +708,7 @@ DateFormatTest::TestBadInput135a()
if (parsePosition.getIndex() != 0) { if (parsePosition.getIndex() != 0) {
UnicodeString s1, s2; UnicodeString s1, s2;
s.extract(0, parsePosition.getIndex(), s1); s.extract(0, parsePosition.getIndex(), s1);
s.extract(parsePosition.getIndex(), s.size(), s2); s.extract(parsePosition.getIndex(), s.length(), s2);
if (date == 0) errln((UnicodeString)"ERROR: null result fmt=\"" + if (date == 0) errln((UnicodeString)"ERROR: null result fmt=\"" +
parseFormats[index] + parseFormats[index] +
"\" pos=" + parsePosition.getIndex() + " " + "\" pos=" + parsePosition.getIndex() + " " +

View File

@ -300,7 +300,7 @@ IntlTest::prettify(const UnicodeString &source,
target.remove(); target.remove();
target += "\""; target += "\"";
for (i = 0; i < source.size(); i += 1) for (i = 0; i < source.length(); i += 1)
{ {
UChar ch = source[i]; UChar ch = source[i];
@ -710,7 +710,7 @@ void IntlTest::LL_message( UnicodeString message, bool_t newline )
int32_t saveFlags = stream.flags(); int32_t saveFlags = stream.flags();
stream << hex; stream << hex;
int32_t len = message.size(); int32_t len = message.length();
UTextOffset pos = 0; UTextOffset pos = 0;
bool_t gen = FALSE; bool_t gen = FALSE;
do{ do{

View File

@ -129,12 +129,12 @@ void CollationIteratorTest::TestOffset(char *par)
int32_t offset = iter->getOffset(); int32_t offset = iter->getOffset();
if (offset != test1.size()) if (offset != test1.length())
{ {
UnicodeString msg1("offset at end != length: "); UnicodeString msg1("offset at end != length: ");
UnicodeString msg2(" vs "); UnicodeString msg2(" vs ");
errln(msg1 + offset + msg2 + test1.size()); errln(msg1 + offset + msg2 + test1.length());
} }
// Now set the offset back to the beginning and see if it works // Now set the offset back to the beginning and see if it works

View File

@ -752,14 +752,14 @@ void IntlTestTextBoundary::TestLineInvariants()
// it doesn't break around the non-breaking characters // it doesn't break around the non-breaking characters
UnicodeString noBreak = CharsToUnicodeString("\\u00a0\\u2007\\u2011\\ufeff"); UnicodeString noBreak = CharsToUnicodeString("\\u00a0\\u2007\\u2011\\ufeff");
UnicodeString work("aaa"); UnicodeString work("aaa");
for (i = 0; i < testChars.size(); i++) { for (i = 0; i < testChars.length(); i++) {
UChar c = testChars[i]; UChar c = testChars[i];
if (c == '\r' || c == '\n' || c == 0x2029 || c == 0x2028 || c == 0x0003) if (c == '\r' || c == '\n' || c == 0x2029 || c == 0x2028 || c == 0x0003)
continue; continue;
work[0] = c; work[0] = c;
for (j = 0; j < noBreak.size(); j++) { for (j = 0; j < noBreak.length(); j++) {
work[1] = noBreak[j]; work[1] = noBreak[j];
for (k = 0; k < testChars.size(); k++) { for (k = 0; k < testChars.length(); k++) {
work[2] = testChars[k]; work[2] = testChars[k];
e->setText(&work); e->setText(&work);
for (int l = e->first(); l != BreakIterator::DONE; l = e->next()) for (int l = e->first(); l != BreakIterator::DONE; l = e->next())
@ -777,11 +777,11 @@ void IntlTestTextBoundary::TestLineInvariants()
// it does break after hyphens (unless they're followed by a digit, a non-spacing mark, // it does break after hyphens (unless they're followed by a digit, a non-spacing mark,
// a currency symbol, a non-breaking space, or a line or paragraph separator) // a currency symbol, a non-breaking space, or a line or paragraph separator)
UnicodeString dashes = CharsToUnicodeString("-\\u00ad\\u2010\\u2012\\u2013\\u2014"); UnicodeString dashes = CharsToUnicodeString("-\\u00ad\\u2010\\u2012\\u2013\\u2014");
for (i = 0; i < testChars.size(); i++) { for (i = 0; i < testChars.length(); i++) {
work[0] = testChars[i]; work[0] = testChars[i];
for (j = 0; j < dashes.size(); j++) { for (j = 0; j < dashes.length(); j++) {
work[1] = dashes[j]; work[1] = dashes[j];
for (k = 0; k < testChars.size(); k++) { for (k = 0; k < testChars.length(); k++) {
UChar c = testChars[k]; UChar c = testChars[k];
if (Unicode::getType(c) == Unicode::DECIMAL_DIGIT_NUMBER || if (Unicode::getType(c) == Unicode::DECIMAL_DIGIT_NUMBER ||
Unicode::getType(c) == Unicode::OTHER_NUMBER || Unicode::getType(c) == Unicode::OTHER_NUMBER ||
@ -915,7 +915,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
UTextOffset i; UTextOffset i;
for (i = 0; i < precedingChars.size(); i++) { for (i = 0; i < precedingChars.length(); i++) {
testString[1] = precedingChars[i]; testString[1] = precedingChars[i];
iter->adoptText(it); iter->adoptText(it);
int32_t j = iter->first(); int32_t j = iter->first();
@ -931,7 +931,7 @@ void IntlTestTextBoundary::TestJapaneseLineBreak()
+ "' (" + ((int)(precedingChars[i])) + ")"); + "' (" + ((int)(precedingChars[i])) + ")");
} }
for (i = 0; i < followingChars.size(); i++) { for (i = 0; i < followingChars.length(); i++) {
testString[1] = followingChars[i]; testString[1] = followingChars[i];
it = new StringCharacterIterator(testString); it = new StringCharacterIterator(testString);
iter->adoptText(it); iter->adoptText(it);
@ -1053,7 +1053,7 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
CharacterIterator *itSource = 0; CharacterIterator *itSource = 0;
CharacterIterator *itTarget = 0; CharacterIterator *itTarget = 0;
logln("doForwardSelectionTest text of length: "+testText.size()); logln("doForwardSelectionTest text of length: "+testText.length());
// check to make sure setText() and getText() work right // check to make sure setText() and getText() work right
iterator.setText(&testText); iterator.setText(&testText);
@ -1074,7 +1074,7 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
errln((UnicodeString)"current() failed: it returned " + iterator.current() + " and offset was " + offset); errln((UnicodeString)"current() failed: it returned " + iterator.current() + " and offset was " + offset);
expectedResult = result->elementAt(forwardSelectionCounter); expectedResult = result->elementAt(forwardSelectionCounter);
forwardSelectionOffset += expectedResult.size(); forwardSelectionOffset += expectedResult.length();
testText.extractBetween(lastOffset, offset, selectionResult); testText.extractBetween(lastOffset, offset, selectionResult);
if (offset != forwardSelectionOffset) { if (offset != forwardSelectionOffset) {
errln((UnicodeString)"\n*** Selection #" + errln((UnicodeString)"\n*** Selection #" +
@ -1082,11 +1082,11 @@ void IntlTestTextBoundary::doForwardSelectionTest(BreakIterator& iterator,
"\nExpected : " + "\nExpected : " +
expectedResult + expectedResult +
" - length : " + " - length : " +
expectedResult.size() + expectedResult.length() +
"\nSelected : " + "\nSelected : " +
selectionResult + selectionResult +
" - length : " + " - length : " +
selectionResult.size()); selectionResult.length());
} }
logln((UnicodeString)"#" + forwardSelectionCounter + " ["+lastOffset+", "+offset+"] : " + selectionResult); logln((UnicodeString)"#" + forwardSelectionCounter + " ["+lastOffset+", "+offset+"] : " + selectionResult);
@ -1105,7 +1105,7 @@ void IntlTestTextBoundary::doBackwardSelectionTest(BreakIterator& iterator,
Vector* result) Vector* result)
{ {
int32_t backwardSelectionCounter = (result->size() - 1); int32_t backwardSelectionCounter = (result->size() - 1);
int32_t neededOffset = testText.size(); int32_t neededOffset = testText.length();
int32_t lastOffset = iterator.last(); int32_t lastOffset = iterator.last();
iterator.setText(&testText); iterator.setText(&testText);
int32_t offset = iterator.previous(); int32_t offset = iterator.previous();
@ -1116,7 +1116,7 @@ void IntlTestTextBoundary::doBackwardSelectionTest(BreakIterator& iterator,
while(offset != BreakIterator::DONE) while(offset != BreakIterator::DONE)
{ {
expectedResult = (UnicodeString)result->elementAt(backwardSelectionCounter); expectedResult = (UnicodeString)result->elementAt(backwardSelectionCounter);
neededOffset -= expectedResult.size(); neededOffset -= expectedResult.length();
testText.extractBetween(offset, lastOffset, selectionResult); testText.extractBetween(offset, lastOffset, selectionResult);
if(offset != neededOffset) { if(offset != neededOffset) {
errln( errln(
@ -1161,16 +1161,16 @@ void IntlTestTextBoundary::doFirstSelectionTest(BreakIterator& iterator,
"\nExpexcted : " + "\nExpexcted : " +
expectedFirstSelection + expectedFirstSelection +
" - length : " + " - length : " +
expectedFirstSelection.size() + expectedFirstSelection.length() +
"\nSelected : " + "\nSelected : " +
tempFirst + tempFirst +
" - length : " + " - length : " +
tempFirst.size() + tempFirst.length() +
"\n"); "\n");
success = FALSE; success = FALSE;
} }
} }
else if (selectionStart != 0 || testText.size() != 0) { else if (selectionStart != 0 || testText.length() != 0) {
errln((UnicodeString)"\n### Error in TTestFindWord::doFirstSelectionTest. Could not get first selection.\n"+ errln((UnicodeString)"\n### Error in TTestFindWord::doFirstSelectionTest. Could not get first selection.\n"+
"start = "+selectionStart+" end = "+selectionEnd); "start = "+selectionStart+" end = "+selectionEnd);
success = FALSE; success = FALSE;
@ -1208,16 +1208,16 @@ void IntlTestTextBoundary::doLastSelectionTest(BreakIterator& iterator,
"\nExpexcted : " + "\nExpexcted : " +
expectedLastSelection + expectedLastSelection +
" - length : " + " - length : " +
expectedLastSelection.size() + expectedLastSelection.length() +
"\nSelected : " + "\nSelected : " +
tempLast + tempLast +
" - length : " + " - length : " +
tempLast.size() + tempLast.length() +
"\n"); "\n");
success = FALSE; success = FALSE;
} }
} }
else if (selectionEnd != 0 || testText.size() != 0) { else if (selectionEnd != 0 || testText.length() != 0) {
errln((UnicodeString)"\n### Error in TTestFindWord::doLastSelectionTest. Could not get last selection."+ errln((UnicodeString)"\n### Error in TTestFindWord::doLastSelectionTest. Could not get last selection."+
"["+selectionStart+","+selectionEnd+"]"); "["+selectionStart+","+selectionEnd+"]");
success = FALSE; success = FALSE;
@ -1242,7 +1242,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
Vector* result) Vector* result)
{ {
int32_t arrayCount = result->size(); int32_t arrayCount = result->size();
int32_t textLength = testText.size(); int32_t textLength = testText.length();
iterator.setText(&testText); iterator.setText(&testText);
for(UTextOffset offset = 0; offset < textLength; offset++) { for(UTextOffset offset = 0; offset < textLength; offset++) {
int32_t selBegin = iterator.preceding(offset); int32_t selBegin = iterator.preceding(offset);
@ -1253,7 +1253,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
int32_t pos = 0; int32_t pos = 0;
if (selBegin != BreakIterator::DONE) { if (selBegin != BreakIterator::DONE) {
while (pos < selBegin && entry < arrayCount) { while (pos < selBegin && entry < arrayCount) {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
if (pos != selBegin) { if (pos != selBegin) {
@ -1261,7 +1261,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
continue; continue;
} }
else { else {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
} }
@ -1271,7 +1271,7 @@ void IntlTestTextBoundary::doForwardIndexSelectionTest(BreakIterator& iterator,
continue; continue;
} }
else { else {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
} }
@ -1290,7 +1290,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
Vector* result) Vector* result)
{ {
int32_t arrayCount = result->size(); int32_t arrayCount = result->size();
int32_t textLength = testText.size(); int32_t textLength = testText.length();
iterator.setText(&testText); iterator.setText(&testText);
for(UTextOffset offset = textLength - 1; offset >= 0; offset--) { for(UTextOffset offset = textLength - 1; offset >= 0; offset--) {
int32_t selBegin = iterator.preceding(offset); int32_t selBegin = iterator.preceding(offset);
@ -1301,7 +1301,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
int32_t pos = 0; int32_t pos = 0;
if (selBegin != BreakIterator::DONE) { if (selBegin != BreakIterator::DONE) {
while (pos < selBegin && entry < arrayCount) { while (pos < selBegin && entry < arrayCount) {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
if (pos != selBegin) { if (pos != selBegin) {
@ -1309,7 +1309,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
continue; continue;
} }
else { else {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
} }
@ -1319,7 +1319,7 @@ void IntlTestTextBoundary::doBackwardIndexSelectionTest(BreakIterator& iterator,
continue; continue;
} }
else { else {
pos += ((UnicodeString)(result->elementAt(entry))).size(); pos += ((UnicodeString)(result->elementAt(entry))).length();
++entry; ++entry;
} }
} }
@ -1337,7 +1337,7 @@ void IntlTestTextBoundary::TestBug4153072() {
BreakIterator *iter = BreakIterator::createWordInstance(); BreakIterator *iter = BreakIterator::createWordInstance();
UnicodeString str("...Hello, World!..."); UnicodeString str("...Hello, World!...");
int32_t begin = 3; int32_t begin = 3;
int32_t end = str.size() - 3; int32_t end = str.length() - 3;
bool_t gotException = FALSE; bool_t gotException = FALSE;
bool_t dummy; bool_t dummy;
@ -1363,7 +1363,7 @@ void IntlTestTextBoundary::doMultipleSelectionTest(BreakIterator& iterator,
int32_t testOffset; int32_t testOffset;
int32_t count = 0; int32_t count = 0;
logln("doMultipleSelectionTest text of length: "+testText.size()); logln("doMultipleSelectionTest text of length: "+testText.length());
if (*testIterator != iterator) if (*testIterator != iterator)
errln("clone() or operator!= failed: two clones compared unequal"); errln("clone() or operator!= failed: two clones compared unequal");
@ -1410,11 +1410,11 @@ void IntlTestTextBoundary::doBreakInvariantTest(BreakIterator& tb, UnicodeString
UnicodeString breaks = CharsToUnicodeString("\r\n\\u2029\\u2028"); UnicodeString breaks = CharsToUnicodeString("\r\n\\u2029\\u2028");
UTextOffset i, j; UTextOffset i, j;
for (i = 0; i < breaks.size(); i++) { for (i = 0; i < breaks.length(); i++) {
work[1] = breaks[i]; work[1] = breaks[i];
for (j = 0; j < testChars.size(); j++) { for (j = 0; j < testChars.length(); j++) {
work[0] = testChars[j]; work[0] = testChars[j];
for (int k = 0; k < testChars.size(); k++) { for (int k = 0; k < testChars.length(); k++) {
UChar c = testChars[k]; UChar c = testChars[k];
// if a cr is followed by lf, ps, ls or etx, don't do the check (that's // if a cr is followed by lf, ps, ls or etx, don't do the check (that's
@ -1449,9 +1449,9 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
UTextOffset i, j; UTextOffset i, j;
// a break should never occur between CR and LF // a break should never occur between CR and LF
for (i = 0; i < testChars.size(); i++) { for (i = 0; i < testChars.length(); i++) {
work[0] = testChars[i]; work[0] = testChars[i];
for (j = 0; j < testChars.size(); j++) { for (j = 0; j < testChars.length(); j++) {
work[3] = testChars[j]; work[3] = testChars[j];
tb.setText(&work); tb.setText(&work);
for (int32_t k = tb.first(); k != BreakIterator::DONE; k = tb.next()) for (int32_t k = tb.first(); k != BreakIterator::DONE; k = tb.next())
@ -1469,12 +1469,12 @@ void IntlTestTextBoundary::doOtherInvariantTest(BreakIterator& tb, UnicodeString
// character is CR, LF, PS, or LS // character is CR, LF, PS, or LS
work.remove(); work.remove();
work += "aaaa"; work += "aaaa";
for (i = 0; i < testChars.size(); i++) { for (i = 0; i < testChars.length(); i++) {
UChar c = testChars[i]; UChar c = testChars[i];
if (c == '\n' || c == '\r' || c == 0x2029 || c == 0x2028 || c == 0x0003) if (c == '\n' || c == '\r' || c == 0x2029 || c == 0x2028 || c == 0x0003)
continue; continue;
work[1] = c; work[1] = c;
for (j = 0; j < testChars.size(); j++) { for (j = 0; j < testChars.length(); j++) {
c = testChars[j]; c = testChars[j];
if ((Unicode::getType(c) != Unicode::NON_SPACING_MARK) && if ((Unicode::getType(c) != Unicode::NON_SPACING_MARK) &&
(Unicode::getType(c) != Unicode::ENCLOSING_MARK)) (Unicode::getType(c) != Unicode::ENCLOSING_MARK))
@ -1500,7 +1500,7 @@ void IntlTestTextBoundary::sample(BreakIterator& tb,
UnicodeString substring; UnicodeString substring;
bool_t verboseWas = verbose; bool_t verboseWas = verbose;
verbose = TRUE; verbose = TRUE;
logln("-------------------------"+title+" length = "+text.size()); logln("-------------------------"+title+" length = "+text.length());
tb.setText(&text); tb.setText(&text);
int32_t start = tb.first(); int32_t start = tb.first();
int32_t end; int32_t end;

View File

@ -151,7 +151,7 @@ void LocaleTest::TestBasicGetters() {
if (testLocale.getCountry(temp) != (dataTable[CTRY][i])) if (testLocale.getCountry(temp) != (dataTable[CTRY][i]))
errln(" Country code mismatch: " + temp + " versus " errln(" Country code mismatch: " + temp + " versus "
+ dataTable[CTRY][i]); + dataTable[CTRY][i]);
if (testLocale.getVariant(temp).size() != 0) if (testLocale.getVariant(temp).length() != 0)
errln(" Variant code mismatch: " + temp + " versus \"\""); errln(" Variant code mismatch: " + temp + " versus \"\"");
} }
@ -496,27 +496,27 @@ void LocaleTest::doTestDisplayNames(Locale& inLocale,
UnicodeString expectedName; UnicodeString expectedName;
expectedLang = dataTable[compareIndex][i]; expectedLang = dataTable[compareIndex][i];
if (expectedLang.size() == 0 && defaultIsFrench) if (expectedLang.length() == 0 && defaultIsFrench)
expectedLang = dataTable[DLANG_FR][i]; expectedLang = dataTable[DLANG_FR][i];
if (expectedLang.size() == 0) if (expectedLang.length() == 0)
expectedLang = dataTable[DLANG_EN][i]; expectedLang = dataTable[DLANG_EN][i];
expectedCtry = dataTable[compareIndex + 1][i]; expectedCtry = dataTable[compareIndex + 1][i];
if (expectedCtry.size() == 0 && defaultIsFrench) if (expectedCtry.length() == 0 && defaultIsFrench)
expectedCtry = dataTable[DCTRY_FR][i]; expectedCtry = dataTable[DCTRY_FR][i];
if (expectedCtry.size() == 0) if (expectedCtry.length() == 0)
expectedCtry = dataTable[DCTRY_EN][i]; expectedCtry = dataTable[DCTRY_EN][i];
expectedVar = dataTable[compareIndex + 2][i]; expectedVar = dataTable[compareIndex + 2][i];
if (expectedVar.size() == 0 && defaultIsFrench) if (expectedVar.length() == 0 && defaultIsFrench)
expectedVar = dataTable[DVAR_FR][i]; expectedVar = dataTable[DVAR_FR][i];
if (expectedVar.size() == 0) if (expectedVar.length() == 0)
expectedVar = dataTable[DVAR_EN][i]; expectedVar = dataTable[DVAR_EN][i];
expectedName = dataTable[compareIndex + 3][i]; expectedName = dataTable[compareIndex + 3][i];
if (expectedName.size() == 0 && defaultIsFrench) if (expectedName.length() == 0 && defaultIsFrench)
expectedName = dataTable[DNAME_FR][i]; expectedName = dataTable[DNAME_FR][i];
if (expectedName.size() == 0) if (expectedName.length() == 0)
expectedName = dataTable[DNAME_EN][i]; expectedName = dataTable[DNAME_EN][i];
if (testLang != expectedLang) if (testLang != expectedLang)
@ -703,7 +703,7 @@ LocaleTest::TestGetLangsAndCountries()
UnicodeString lc(test[i]); UnicodeString lc(test[i]);
if (test[i] != lc.toLower()) if (test[i] != lc.toLower())
errln(test[i] + " is not all lower case."); errln(test[i] + " is not all lower case.");
if (test[i].size() != 2) if (test[i].length() != 2)
errln(test[i] + " is not two characters long."); errln(test[i] + " is not two characters long.");
if (i > 0 && test[i].compare(test[i - 1]) <= 0) if (i > 0 && test[i].compare(test[i - 1]) <= 0)
errln(test[i] + " appears in an out-of-order position in the list."); errln(test[i] + " appears in an out-of-order position in the list.");
@ -732,7 +732,7 @@ LocaleTest::TestGetLangsAndCountries()
UnicodeString uc(test[i]); UnicodeString uc(test[i]);
if (test[i] != uc.toUpper()) if (test[i] != uc.toUpper())
errln(test[i] + " is not all upper case."); errln(test[i] + " is not all upper case.");
if (test[i].size() != 2) if (test[i].length() != 2)
errln(test[i] + " is not two characters long."); errln(test[i] + " is not two characters long.");
if (i > 0 && test[i].compare(test[i - 1]) <= 0) if (i > 0 && test[i].compare(test[i - 1]) <= 0)
errln(test[i] + " appears in an out-of-order position in the list."); errln(test[i] + " appears in an out-of-order position in the list.");

View File

@ -292,7 +292,7 @@ NumberFormatRoundTripTest::escape(UnicodeString& s)
{ {
UnicodeString copy(s); UnicodeString copy(s);
s.remove(); s.remove();
for(int i = 0; i < copy.size(); ++i) { for(int i = 0; i < copy.length(); ++i) {
UChar c = copy[i]; UChar c = copy[i];
if(c < 0x00FF) if(c < 0x00FF)
s += c; s += c;

View File

@ -157,7 +157,7 @@ NumberFormatTest::TestExponential()
if (af.getType() == Formattable::kLong) a = af.getLong(); if (af.getType() == Formattable::kLong) a = af.getLong();
else if (af.getType() == Formattable::kDouble) a = af.getDouble(); else if (af.getType() == Formattable::kDouble) a = af.getDouble();
else errln((UnicodeString)"FAIL: Non-numeric Formattable returned"); else errln((UnicodeString)"FAIL: Non-numeric Formattable returned");
if (pos.getIndex() == s.size()) if (pos.getIndex() == s.length())
{ {
logln((UnicodeString)" -parse-> " + a); logln((UnicodeString)" -parse-> " + a);
if (a != valParse[v+ival]) if (a != valParse[v+ival])
@ -179,7 +179,7 @@ NumberFormatTest::TestExponential()
int32_t a; int32_t a;
if (af.getType() == Formattable::kLong) a = af.getLong(); if (af.getType() == Formattable::kLong) a = af.getLong();
else errln((UnicodeString)"FAIL: Non-long Formattable returned"); else errln((UnicodeString)"FAIL: Non-long Formattable returned");
if (pos.getIndex() == s.size()) if (pos.getIndex() == s.length())
{ {
logln((UnicodeString)" -parse-> " + a); logln((UnicodeString)" -parse-> " + a);
if (a != lvalParse[v+ilval]) if (a != lvalParse[v+ilval])
@ -269,7 +269,7 @@ UnicodeString&
NumberFormatTest::escape(UnicodeString& s) NumberFormatTest::escape(UnicodeString& s)
{ {
UnicodeString buf; UnicodeString buf;
for (int32_t i=0; i<s.size(); ++i) for (int32_t i=0; i<s.length(); ++i)
{ {
UChar c = s[(UTextOffset)i]; UChar c = s[(UTextOffset)i];
if (c <= (UChar)0x7F) buf += c; if (c <= (UChar)0x7F) buf += c;

View File

@ -121,7 +121,7 @@ static UnicodeString str(const char *input)
while ((index = result.indexOf("\\u")) != -1) while ((index = result.indexOf("\\u")) != -1)
{ {
if (index + 6 <= result.size()) if (index + 6 <= result.length())
{ {
UChar c = 0; UChar c = 0;
for (int i = index + 2; i < index + 6; i++) { for (int i = index + 2; i < index + 6; i++) {
@ -258,11 +258,11 @@ void NumberFormatRegressionTest::Test4087535 ()
UnicodeString buffer; UnicodeString buffer;
FieldPosition pos(FieldPosition::DONT_CARE); FieldPosition pos(FieldPosition::DONT_CARE);
buffer = df->format(n, buffer, pos); buffer = df->format(n, buffer, pos);
if (buffer.size() == 0) if (buffer.length() == 0)
errln(/*n + */": '" + buffer + "'"); errln(/*n + */": '" + buffer + "'");
n = 0.1; n = 0.1;
buffer = df->format(n, buffer, pos); buffer = df->format(n, buffer, pos);
if (buffer.size() == 0) if (buffer.length() == 0)
errln(/*n + */": '" + buffer + "'"); errln(/*n + */": '" + buffer + "'");
delete df; delete df;
@ -1445,16 +1445,16 @@ void NumberFormatRegressionTest::Test4122840()
symbols->setDecimalSeparator(symbols->getMonetaryDecimalSeparator()); symbols->setDecimalSeparator(symbols->getMonetaryDecimalSeparator());
UnicodeString buf(pattern); UnicodeString buf(pattern);
for (int j = 0; j < buf.size(); j++) { for (int j = 0; j < buf.length(); j++) {
if (buf[j] == 0x00a4 ) { if (buf[j] == 0x00a4 ) {
if(buf[j + 1] == 0x00a4) { if(buf[j + 1] == 0x00a4) {
// {sfb} added to support double currency marker (intl currency sign) // {sfb} added to support double currency marker (intl currency sign)
buf.replace(j, /*j+*/2, symbols->getInternationalCurrencySymbol(temp)); buf.replace(j, /*j+*/2, symbols->getInternationalCurrencySymbol(temp));
j += symbols->getInternationalCurrencySymbol(temp).size() - 1 + 1; j += symbols->getInternationalCurrencySymbol(temp).length() - 1 + 1;
} }
else { else {
buf.replace(j, /*j+*/1, symbols->getCurrencySymbol(temp)); buf.replace(j, /*j+*/1, symbols->getCurrencySymbol(temp));
j += symbols->getCurrencySymbol(temp).size() - 1; j += symbols->getCurrencySymbol(temp).length() - 1;
} }
} }
} }

View File

@ -524,7 +524,7 @@ static UChar toHexString(int32_t i) { return i + (i < 10 ? '0' : ('A' - 10)); }
UnicodeString UnicodeString
TransliteratorTest::escape(const UnicodeString& s) { TransliteratorTest::escape(const UnicodeString& s) {
UnicodeString buf; UnicodeString buf;
for (int32_t i=0; i<s.size(); ++i) for (int32_t i=0; i<s.length(); ++i)
{ {
UChar c = s[(UTextOffset)i]; UChar c = s[(UTextOffset)i];
if (' ' <= c && c <= (UChar)0x7F) { if (' ' <= c && c <= (UChar)0x7F) {

View File

@ -444,11 +444,11 @@ UnicodeString showDifference(const UnicodeString& expected, const UnicodeString&
{ {
UnicodeString res; UnicodeString res;
res = expected + "<Expected\n"; res = expected + "<Expected\n";
if(expected.size() != result.size()) if(expected.length() != result.length())
res += " [ Different lengths ] \n"; res += " [ Different lengths ] \n";
else else
{ {
for(int32_t i=0;i<expected.size();i++) for(int32_t i=0;i<expected.length();i++)
{ {
if(expected[i] == result[i]) if(expected[i] == result[i])
{ {

View File

@ -33,7 +33,7 @@ static UnicodeString str(const char *input)
while ((index = result.indexOf("\\u")) != -1) while ((index = result.indexOf("\\u")) != -1)
{ {
if (index + 6 <= result.size()) if (index + 6 <= result.length())
{ {
UChar c = 0; UChar c = 0;
for (int i = index + 2; i < index + 6; i++) { for (int i = index + 2; i < index + 6; i++) {
@ -267,7 +267,7 @@ UnicodeString BasicNormalizerTest::hex(UChar ch) {
UnicodeString BasicNormalizerTest::hex(const UnicodeString& s) { UnicodeString BasicNormalizerTest::hex(const UnicodeString& s) {
UnicodeString result; UnicodeString result;
for (int i = 0; i < s.size(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (i != 0) result += ','; if (i != 0) result += ',';
appendHex(s[i], 4, result); appendHex(s[i], 4, result);
} }

View File

@ -129,7 +129,7 @@ static UChar toHexString(int32_t i) { return i + (i < 10 ? '0' : ('A' - 10)); }
UnicodeString UnicodeString
UnicodeSetTest::escape(const UnicodeString& s) { UnicodeSetTest::escape(const UnicodeString& s) {
UnicodeString buf; UnicodeString buf;
for (int32_t i=0; i<s.size(); ++i) for (int32_t i=0; i<s.length(); ++i)
{ {
UChar c = s[(UTextOffset)i]; UChar c = s[(UTextOffset)i];
if (' ' <= c && c <= (UChar)0x7F) { if (' ' <= c && c <= (UChar)0x7F) {

View File

@ -82,10 +82,10 @@ UnicodeStringTest::TestBasicManipulation()
if (test2 != expectedValue) if (test2 != expectedValue)
errln("operator+=() failed: expected \"" + expectedValue + "\"\n,got \"" + test2 + "\""); errln("operator+=() failed: expected \"" + expectedValue + "\"\n,got \"" + test2 + "\"");
if (test1.size() != 70) if (test1.length() != 70)
errln("size() failed: expected 70, got " + test1.size()); errln("length() failed: expected 70, got " + test1.length());
if (test2.size() != 30) if (test2.length() != 30)
errln("size() failed: expected 30, got " + test2.size()); errln("length() failed: expected 30, got " + test2.length());
} }
void void
@ -225,7 +225,7 @@ UnicodeStringTest::TestRemoveReplace()
" expected \"The SPAM in SPAM SPAM SPAM on the SPAM\",\n" " expected \"The SPAM in SPAM SPAM SPAM on the SPAM\",\n"
" got \"" + test1 + "\""); " got \"" + test1 + "\"");
for (UTextOffset i = 0; i < test1.size(); i++) for (UTextOffset i = 0; i < test1.length(); i++)
if (test5[i] != 'S' && test5[i] != 'P' && test5[i] != 'A' && test5[i] != 'M' && test5[i] != ' ') if (test5[i] != 'S' && test5[i] != 'P' && test5[i] != 'A' && test5[i] != 'M' && test5[i] != ' ')
test1[i] = 'x'; test1[i] = 'x';
@ -235,7 +235,7 @@ UnicodeStringTest::TestRemoveReplace()
" got \"" + test1 + "\""); " got \"" + test1 + "\"");
test1.remove(); test1.remove();
if (test1.size() != 0) if (test1.length() != 0)
errln("Remove() failed: expected empty string, got \"" + test1 + "\""); errln("Remove() failed: expected empty string, got \"" + test1 + "\"");
} }
@ -301,14 +301,14 @@ UnicodeStringTest::TestCaseConversion()
if (test3 != expectedResult) if (test3 != expectedResult)
errln("toUpper failed: expected \"" + expectedResult + "\", got \"" + test3 + "\"."); errln("toUpper failed: expected \"" + expectedResult + "\", got \"" + test3 + "\".");
test4.replace(0, test4.size(), uppercaseGreek); test4.replace(0, test4.length(), uppercaseGreek);
test4.toLower(Locale("el", "GR")); test4.toLower(Locale("el", "GR"));
expectedResult = lowercaseGreek; expectedResult = lowercaseGreek;
if (test4 != expectedResult) if (test4 != expectedResult)
errln("toLower failed: expected \"" + expectedResult + "\", got \"" + test4 + "\"."); errln("toLower failed: expected \"" + expectedResult + "\", got \"" + test4 + "\".");
test4.replace(0, test4.size(), lowercaseGreek); test4.replace(0, test4.length(), lowercaseGreek);
test4.toUpper(); test4.toUpper();
expectedResult = uppercaseGreek; expectedResult = uppercaseGreek;
@ -326,14 +326,14 @@ UnicodeStringTest::TestSearching()
uint16_t occurrences = 0; uint16_t occurrences = 0;
UTextOffset startPos = 0; UTextOffset startPos = 0;
for ( ; for ( ;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0) (startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
; ;
if (occurrences != 6) if (occurrences != 6)
errln("indexOf failed: expected to find 6 occurrences, found " + occurrences); errln("indexOf failed: expected to find 6 occurrences, found " + occurrences);
for ( occurrences = 0, startPos = 10; for ( occurrences = 0, startPos = 10;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0) (startPos = test1.indexOf(test2, startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
; ;
if (occurrences != 4) if (occurrences != 4)
@ -341,28 +341,28 @@ UnicodeStringTest::TestSearching()
UTextOffset endPos = 28; UTextOffset endPos = 28;
for ( occurrences = 0, startPos = 5; for ( occurrences = 0, startPos = 5;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(test2, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 4) : 0) (startPos = test1.indexOf(test2, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 4) : 0)
; ;
if (occurrences != 4) if (occurrences != 4)
errln("indexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences); errln("indexOf with starting and ending offsets failed: expected to find 4 occurrences, found " + occurrences);
for ( occurrences = 0, startPos = 0; for ( occurrences = 0, startPos = 0;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0) (startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
; ;
if (occurrences != 16) if (occurrences != 16)
errln("indexOf with character failed: expected to find 16 occurrences, found " + occurrences); errln("indexOf with character failed: expected to find 16 occurrences, found " + occurrences);
for ( occurrences = 0, startPos = 10; for ( occurrences = 0, startPos = 10;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0) (startPos = test1.indexOf(testChar, startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
; ;
if (occurrences != 12) if (occurrences != 12)
errln("indexOf with character & start offset failed: expected to find 12 occurrences, found " + occurrences); errln("indexOf with character & start offset failed: expected to find 12 occurrences, found " + occurrences);
for ( occurrences = 0, startPos = 5, endPos = 28; for ( occurrences = 0, startPos = 5, endPos = 28;
startPos != -1 && startPos < test1.size(); startPos != -1 && startPos < test1.length();
(startPos = test1.indexOf(testChar, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 1) : 0) (startPos = test1.indexOf(testChar, startPos, endPos - startPos)) != -1 ? (++occurrences, startPos += 1) : 0)
; ;
if (occurrences != 10) if (occurrences != 10)
@ -553,16 +553,16 @@ UnicodeStringTest::TestMiscellaneous()
errln("getUChars() affected the string!"); errln("getUChars() affected the string!");
UTextOffset i; UTextOffset i;
for (i = 0; i < test2.size(); i++) for (i = 0; i < test2.length(); i++)
if (test2[i] != test4[i]) if (test2[i] != test4[i])
errln(UnicodeString("getUChars() failed: strings differ at position ") + i); errln(UnicodeString("getUChars() failed: strings differ at position ") + i);
test4 = test1.orphanStorage(); test4 = test1.orphanStorage();
if (test1.size() != 0) if (test1.length() != 0)
errln("orphanStorage() failed: orphaned string's contents is " + test1); errln("orphanStorage() failed: orphaned string's contents is " + test1);
for (i = 0; i < test2.size(); i++) for (i = 0; i < test2.length(); i++)
if (test2[i] != test4[i]) if (test2[i] != test4[i])
errln(UnicodeString("orphanStorage() failed: strings differ at position ") + i); errln(UnicodeString("orphanStorage() failed: strings differ at position ") + i);