diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-05-04 19:41:48 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-05-16 09:34:59 +0000 |
commit | cafefd1d33349209617d391b3b49c9663590b3c9 (patch) | |
tree | a5e8043ea2bc07afdf5e79fd313702ba3dc16d1c /src/corelib/tools/qstringview.cpp | |
parent | 51e1374bae4ae449b04ddeb30c14bc67935705ca (diff) |
QStringView/QLatin1String: add trimmed()
... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've
been using for all other out-of-line string-view member functions to
avoid forcing string-view objects onto the stack for the passing of 'this'.
In the test, had to fix nullness not being propagated from a QByteArray
to the QLatin1String constructed from it. Probably worth fixing in
QLatin1String(QByteArray), too.
[ChangeLog][QtCore] Added qTrimmed() free functions.
[ChangeLog][QtCore][QLatin1String] Added trimmed() function.
Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/tools/qstringview.cpp')
-rw-r--r-- | src/corelib/tools/qstringview.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index 8d2fc996e9..8eefc6d814 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -665,6 +665,18 @@ QT_BEGIN_NAMESPACE */ /*! + \fn QStringView QStringView::trimmed() const + + Strips leading and trailing whitespace and returns the result. + + Whitespace means any character for which QChar::isSpace() returns + \c true. This includes the ASCII characters '\\t', '\\n', '\\v', + '\\f', '\\r', and ' '. + + \sa qTrimmed() +*/ + +/*! \fn bool QStringView::startsWith(QStringView str, Qt::CaseSensitivity cs) const \fn bool QStringView::startsWith(QLatin1String l1, Qt::CaseSensitivity cs) const \fn bool QStringView::startsWith(QChar ch) const |