diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-04-05 08:55:19 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-04-18 09:43:26 +0000 |
commit | fc8cc2573c75b2cb81493dba67b2a9e24699c1ec (patch) | |
tree | db3db0f663ab8503133bc8cfcd13114c3e4873fa /src/corelib/tools/qstringview.cpp | |
parent | d176808eef61d27a6536f268125dab4088a248d3 (diff) |
QStringView: add chopped(), chop(), and truncate()
Change-Id: I33925f5b2b3e0904f47f18f3cbab480d7f844734
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qstringview.cpp')
-rw-r--r-- | src/corelib/tools/qstringview.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index 65f76965f6..1dc01e321b 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -578,7 +578,7 @@ QT_BEGIN_NAMESPACE \note The behavior is undefined when \a start < 0 or \a start > size(). - \sa left(), right() + \sa left(), right(), chopped(), chop(), truncate() */ /*! @@ -591,7 +591,7 @@ QT_BEGIN_NAMESPACE \note The behavior is undefined when \a start < 0, \a length < 0, or \a start + \a length > size(). - \sa left(), right() + \sa left(), right(), chopped(), chop(), truncate() */ /*! @@ -602,7 +602,7 @@ QT_BEGIN_NAMESPACE \note The behavior is undefined when \a length < 0 or \a length > size(). - \sa mid(), right() + \sa mid(), right(), chopped(), chop(), truncate() */ /*! @@ -613,7 +613,44 @@ QT_BEGIN_NAMESPACE \note The behavior is undefined when \a length < 0 or \a length > size(). - \sa mid(), left() + \sa mid(), left(), chopped(), chop(), truncate() +*/ + +/*! + \fn QStringView QStringView::chopped(qssize_t length) const + + Returns the substring of length size() - \a length starting at the + beginning of this object. + + Same as \c{left(size() - length)}. + + \note The behavior is undefined when \a length < 0 or \a length > size(). + + \sa mid(), left(), right(), chop(), truncate() +*/ + +/*! + \fn void QStringView::truncate(qssize_t length) + + Truncates this string view to length \a length. + + Same as \c{*this = left(length)}. + + \note The behavior is undefined when \a length < 0 or \a length > size(). + + \sa mid(), left(), right(), chopped(), chop() +*/ + +/*! + \fn void QStringView::chop(qssize_t length) + + Truncates this string view by \a length characters. + + Same as \c{*this = left(size() - length)}. + + \note The behavior is undefined when \a length < 0 or \a length > size(). + + \sa mid(), left(), right(), chopped(), truncate() */ /*! |