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:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user