Fix for bug# 7548.

Added a Sanitize() method for attribute tokens that
would remove non-alpha-non-digit characters from the
end of a string ( could be a "key" or "value")
This commit is contained in:
harishd@netscape.com
1999-07-22 18:06:00 +00:00
parent b3eef497f3
commit 36bf3a7af3
6 changed files with 58 additions and 0 deletions

View File

@@ -1046,6 +1046,27 @@ PRInt32 CAttributeToken::GetTokenType(void) {
return eToken_attribute;
}
/*
* Removes non-alpha-non-digit characters from the end of the string
*
* @update harishd 07/15/99
* @param aString - The string might contain garbage at the end!!
* @return
*/
void CAttributeToken::Sanitize(nsString& aString) {
PRInt32 length=aString.Length();
if(length > 0) {
PRUnichar theChar=aString.Last();
while(!nsString::IsAlpha(theChar) && !nsString::IsDigit(theChar)) {
aString.Truncate(length-1);
length = aString.Length();
if(length <= 0) break;
theChar = aString.Last();
}
}
return;
}
/*
* Dump contents of this token to given output stream
*