Obsolete Members for QUtf8StringView
QUtf8StringView 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。
公共函数
(deprecated in 6.0) QUtf8StringView | left(qsizetype n) const |
(deprecated in 6.0) QUtf8StringView | mid(qsizetype pos, qsizetype n = -1) const |
(deprecated in 6.0) QUtf8StringView | right(qsizetype n) const |
成员函数文档
[constexpr, deprecated in 6.0] QUtf8StringView QUtf8StringView::left(qsizetype n) const
自 6.0 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
在新代码中请改用 `first()`。
返回该对象中从位置 0 开始、长度为n 的子字符串。
如果 `n ` 大于或等于 `size()`,或者小于零,则返回整个字符串视图。
另请参阅 first()、last()、sliced()、chopped()、chop()、truncate() 和slice()。
[constexpr, deprecated in 6.0] QUtf8StringView QUtf8StringView::mid(qsizetype pos, qsizetype n = -1) const
自 6.0 版本起,此函数已弃用。我们强烈建议不要在新代码中使用它。
返回该对象中从位置pos 开始、长度为n 的子字符串。
在新代码中请改用sliced()。
如果n 超过字符串视图的长度,则返回一个空字符串视图。如果从pos 开始的字符串视图中可用的代码点少于n ,或者如果n 为负数(默认值),则该函数返回从pos 开始的所有可用代码点。
另请参阅 first()、last()、sliced()、chopped()、chop()、truncate() 以及slice()。
[constexpr, deprecated in 6.0] QUtf8StringView QUtf8StringView::right(qsizetype n) const
自 6.0 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
在新代码中请改用last()。
返回该对象中从位置size() 开始、长度为n 的子字符串,结束位置为n 。
如果n 大于或等于size(),或者小于零,则返回整个字符串视图。
另请参阅 first()、last()、sliced()、chopped()、chop()、truncate() 以及slice()。
© 2026 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.