diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-02 09:30:34 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-03-09 15:58:47 +0100 |
commit | 30d28810ee73052338e478a5472933c7b9c7d725 (patch) | |
tree | ef862951f799dca9404363956f2c05e5bcf3505e /src/corelib/text/qstring.h | |
parent | 567c31e8ee92a8071c731aac6fc6729d16d7439b (diff) |
Add QLatin1String::count(needle)
[ChangeLog][QtCore][QLatin1String] Added QLatin1String::count(needle).
Task-number: QTBUG-98433
Change-Id: I31c9fdf14fd81500722ff9f5998eadf0e6cedc5c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.h')
-rw-r--r-- | src/corelib/text/qstring.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 55cf471d10..db4e0cbd8a 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -177,6 +177,13 @@ public: [[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); } + [[nodiscard]] qsizetype count(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::count(*this, str, cs); } + [[nodiscard]] qsizetype count(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const + { return QtPrivate::count(*this, str, cs); } + [[nodiscard]] qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept + { return QtPrivate::count(*this, ch, cs); } + [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const { return QtPrivate::toIntegral<short>(QByteArrayView(*this), ok, base); } [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const |