QString: move empty "before" note to the relevant replace() overloads

Amends 3e56757d651ffcba9ea65aa990b4e02b05e00b17.

Pick-to: 6.7
Change-Id: I91a59a8b9e3abfeb14272554d5ca0833141ff2ee
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit d16f4cf826d25a7fd1e8c617e4cafaf7cc9a2711)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ahmad Samir 2024-07-02 15:29:34 +03:00 committed by Qt Cherry-pick Bot
parent 2bc0647805
commit 4d9bedc97b

View File

@ -3786,9 +3786,6 @@ static void replace_helper(QString &str, QSpan<size_t> indices, qsizetype blen,
but \a position + \a n goes outside the strings range,
then \a n will be adjusted to stop at the end of the string.
\note If you use an empty \a before argument, the \a after argument will be
inserted \e {before and after} each character of the string.
Example:
\snippet qstring/main.cpp 40
@ -3847,6 +3844,12 @@ QString &QString::replace(qsizetype pos, qsizetype len, QChar after)
Example:
\snippet qstring/main.cpp 86
//! [empty-before-arg-in-replace]
\note If you use an empty \a before argument, the \a after argument will be
inserted \e {before and after} each character of the string.
//! [empty-before-arg-in-replace]
*/
QString &QString::replace(const QString &before, const QString &after, Qt::CaseSensitivity cs)
{
@ -3862,6 +3865,10 @@ QString &QString::replace(const QString &before, const QString &after, Qt::CaseS
after and returns a reference to this string.
\include qstring.qdocinc {search-comparison-case-sensitivity} {search}
\note If \a before points to an \e empty string (that is, \a blen == 0),
the string pointed to by \a after will be inserted \e {before and after}
each character in this string.
*/
QString &QString::replace(const QChar *before, qsizetype blen,
const QChar *after, qsizetype alen,
@ -3997,6 +4004,8 @@ QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs)
\include qstring.qdocinc {search-comparison-case-sensitivity} {search}
\note The text is not rescanned after a replacement.
\include qstring.cpp empty-before-arg-in-replace
*/
QString &QString::replace(QLatin1StringView before, QLatin1StringView after, Qt::CaseSensitivity cs)
{
@ -4021,6 +4030,8 @@ QString &QString::replace(QLatin1StringView before, QLatin1StringView after, Qt:
\include qstring.qdocinc {search-comparison-case-sensitivity} {search}
\note The text is not rescanned after a replacement.
\include qstring.cpp empty-before-arg-in-replace
*/
QString &QString::replace(QLatin1StringView before, const QString &after, Qt::CaseSensitivity cs)
{
@ -4042,6 +4053,8 @@ QString &QString::replace(QLatin1StringView before, const QString &after, Qt::Ca
\include qstring.qdocinc {search-comparison-case-sensitivity} {search}
\note The text is not rescanned after a replacement.
\include qstring.cpp empty-before-arg-in-replace
*/
QString &QString::replace(const QString &before, QLatin1StringView after, Qt::CaseSensitivity cs)
{