summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qstring.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 69751eb6dc..4e7baa18b6 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -2599,10 +2599,15 @@ QString &QString::remove(int pos, int len)
*/
QString &QString::remove(const QString &str, Qt::CaseSensitivity cs)
{
- if (str.d->size) {
- int i = 0;
- while ((i = indexOf(str, i, cs)) != -1)
- remove(i, str.d->size);
+ const int strSize = str.size();
+ if (strSize) {
+ if (strSize == 1) {
+ remove(str.front(), cs);
+ } else {
+ int i = 0;
+ while ((i = indexOf(str, i, cs)) != -1)
+ remove(i, strSize);
+ }
}
return *this;
}