diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-23 12:37:29 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-10-15 11:29:25 +0200 |
commit | b09b87a664415ccf3574cfad94acd0cfd2af21c3 (patch) | |
tree | 12ed87bbe692f609f7c89d1c7021a4b23835aa8c /src/corelib/text/qstringview.h | |
parent | f2b8412f91198ef1d00c06a05183de1768b85757 (diff) |
Add QStringView::count(...)
Also this one as a porting aid towards Qt 6. The implementation is
using QString to keep things simple.
Task-number: QTBUG-86516
Change-Id: Ic033b8678c76a608af8acfc5fab547aeb159933e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r-- | src/corelib/text/qstringview.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 5e561d88a8..38a6a43219 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -300,6 +300,9 @@ public: { return indexOf(s, 0, cs) != qsizetype(-1); } Q_REQUIRED_RESULT inline bool contains(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + Q_REQUIRED_RESULT inline qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + Q_REQUIRED_RESULT inline qsizetype count(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + Q_REQUIRED_RESULT qsizetype lastIndexOf(QChar c, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); } Q_REQUIRED_RESULT qsizetype lastIndexOf(QStringView s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept |