Obsolete Members for QUtf8StringView

The following members of class QUtf8StringView are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

(obsolete) QUtf8StringView left(qsizetype n) const
(obsolete) int length() const
(obsolete) QUtf8StringView mid(qsizetype pos, qsizetype n = -1) const
(obsolete) QUtf8StringView right(qsizetype n) const

Member Function Documentation

QUtf8StringView QUtf8StringView::left(qsizetype n) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use first() instead in new code.

Returns the substring of length n starting at position 0 in this object.

The entire string is returned if n is greater than or equal to size(), or less than zero.

See also first(), last(), sliced(), chopped(), chop(), and truncate().

int QUtf8StringView::length() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use size() and port callers to qsizetype.

Same as size(), except returns the result as an int.

This function is provided for compatibility with other Qt containers.

Warning: QUtf8StringView can represent strings with more than 231 code points. Calling this function on a string view for which size() returns a value greater than INT_MAX constitutes undefined behavior.

See also empty(), isEmpty(), isNull(), and size().

QUtf8StringView QUtf8StringView::mid(qsizetype pos, qsizetype n = -1) const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the substring of length n starting at position pos in this object.

Use sliced() instead in new code.

Returns an empty string view if n exceeds the length of the string. If there are less than n code points available in the string starting at pos, or if n is negative (default), the function returns all code points that are available from pos.

See also first(), last(), sliced(), chopped(), chop(), and truncate().

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use last() instead in new code.

Returns the substring of length n starting at position size() - n in this object.

The entire string is returned if n is greater than or equal to size(), or less than zero.

See also first(), last(), sliced(), chopped(), chop(), and truncate().

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.