landing phase 2 to remove deprecated string calls
git-svn-id: svn://10.0.0.236/trunk@62718 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -153,31 +153,6 @@ void nsString::Truncate(PRUint32 anIndex) {
|
||||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
PRUnichar c1=0;
|
||||
PRUnichar c2=GetCharAt(*this,0);
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
c1=c2;
|
||||
c2=GetCharAt(*this,theIndex);
|
||||
if(c1>c2) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
@@ -1411,31 +1386,6 @@ nsString& nsString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
||||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* search for given string within this string
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user