diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-10-16 20:10:11 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-01 23:03:28 +0100 |
commit | b2ea30dde05d30e2c2c672b17ae6f368164e7f88 (patch) | |
tree | 3deb7e476e100224c8974bbb4810dbf76896ac4d /src/corelib/text/qstring.cpp | |
parent | 11bde366e8316f06db88b95dabd397a35c398b7e (diff) |
QString/QByteArray: add erase/erase_if
[ChangeLog][QtCore][QString] Added erase() and erase_if()
for consistent container erasure.
[ChangeLog][QtCore][QByteArray] Added erase() and erase_if()
for consistent container erasure.
Change-Id: I23e8565d39044c1f1d756500589c1f2b65e1a88f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r-- | src/corelib/text/qstring.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 76f0e15303..17c3e8d3cf 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -3088,6 +3088,16 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) */ /*! + \fn template <typename Predicate> QString &QString::removeIf(Predicate pred) + \since 6.1 + + Removes all elements for which the predicate \a pred returns true + from the string. Returns a reference to the string. + + \sa remove() +*/ + +/*! \fn QString &QString::replace(qsizetype position, qsizetype n, const QString &after) Replaces \a n characters beginning at index \a position with @@ -10138,4 +10148,27 @@ float QStringView::toFloat(bool *ok) const return QLocaleData::convertDoubleToFloat(toDouble(ok), ok); } +/*! + \fn template <typename T> qsizetype erase(QString &s, const T &t) + \relates QString + \since 6.1 + + Removes all elements that compare equal to \a t from the + string \a s. Returns the number of elements removed, if any. + + \sa erase_if +*/ + +/*! + \fn template <typename Predicate> qsizetype erase_if(QString &s, Predicate pred) + \relates QString + \since 6.1 + + Removes all elements for which the predicate \a pred returns true + from the string \a s. Returns the number of elements removed, if + any. + + \sa erase +*/ + QT_END_NAMESPACE |