PIMapIterator
small PIString optimize general PIChunkStream pack optimization
This commit is contained in:
@@ -658,6 +658,26 @@ PIString & PIString::replaceAll(const PIString & what, const PIString & with) {
|
||||
}
|
||||
|
||||
|
||||
PIString & PIString::replaceAll(const PIString & what, const char with) {
|
||||
if (what.isEmpty()) return *this;
|
||||
int l = what.length(), dl = what.length() - 1;
|
||||
for (int i = 0; i < length() - l + 1; ++i) {
|
||||
bool match = true;
|
||||
for (int j = 0; j < l; ++j) {
|
||||
if (at(j + i) != what[j]) {
|
||||
match = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match) continue;
|
||||
if (dl > 0) PIDeque<PIChar>::remove(i, dl);
|
||||
at(i) = PIChar(with);
|
||||
//i -= l;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PIString & PIString::replaceAll(const char what, const char with) {
|
||||
int l = length();
|
||||
for (int i = 0; i < l; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user