Fixed ReplaceSet().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1889 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2002-11-09 11:51:18 +00:00
parent ee37218ef1
commit bff4272dd4

View File

@ -1135,12 +1135,21 @@ BString::ReplaceSet(const char *setOfChars, const char *with)
if (with == NULL)
return *this; //TODO: do something smart
int32 pos;
int32 pos, offset = 0;
int32 withLen = strlen(with);
while ((pos = strcspn(String(), setOfChars)) < Length()) {
while ((pos = strcspn(String() + offset, setOfChars)) < Length()) {
offset += pos;
if (offset >= Length())
break;
_OpenAtBy(offset, withLen - 1);
memcpy(_privateData + offset, with, withLen);
offset += withLen;
}
/*while ((pos = strcspn(String() + offset, setOfChars)) < Length()) {
_OpenAtBy(pos, withLen - 1);
memcpy(_privateData + pos, with, withLen);
}
}*/
return *this;
}