diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2022-10-20 13:25:58 +0200 |
|---|---|---|
| committer | Ahmad Samir <a.samirh78@gmail.com> | 2022-11-03 14:22:51 +0200 |
| commit | dcfab7e28ee9bbdf09138a321e1f8db2b770d4b7 (patch) | |
| tree | 45acbfe0444d54ff95eed0f297e58e65a2dbc5d2 /src/corelib/text/qstring.cpp | |
| parent | 2ab347b0dd77285a84f610e848170157acf37578 (diff) | |
QString, QByteArray: add erase(iterator) method
Fixes: QTBUG-106182
Change-Id: Idc74cc643b90252838ca1a9ca40a330315da421f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
| -rw-r--r-- | src/corelib/text/qstring.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 43b64f399e9..4d7522a2b85 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -8935,7 +8935,8 @@ bool QString::isRightToLeft() const Removes from the string the characters in the half-open range [ \a first , \a last ). Returns an iterator to the character - referred to by \a last before the erase. + immediately after the last erased character (i.e. the character + referred to by \a last before the erase). */ QString::iterator QString::erase(QString::const_iterator first, QString::const_iterator last) { @@ -8945,6 +8946,21 @@ QString::iterator QString::erase(QString::const_iterator first, QString::const_i return begin() + start; } +/*! + \fn QString::iterator QString::erase(QString::const_iterator it) + + \since 6.5 + + Removes the character denoted by \c it from the string. + Returns an iterator to the character immediately after the + erased character. + + \code + QString c = "abcdefg"; + auto it = c.erase(c.cbegin()); // c is now "bcdefg"; "it" points to "b" + \endcode +*/ + /*! \fn void QString::shrink_to_fit() \since 5.10 |
