PIMapIterator

small PIString optimize
general PIChunkStream pack optimization
This commit is contained in:
2020-08-02 15:57:21 +03:00
parent 1fb5356825
commit b468a6d581
7 changed files with 253 additions and 78 deletions

View File

@@ -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) {