Obsolete Members for QAnyStringView
类QAnyStringView 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。
公共函数
(since 6.5, deprecated) QAnyStringView | left(qsizetype n) const |
(since 6.5, deprecated) QAnyStringView | mid(qsizetype pos, qsizetype n = -1) const |
(since 6.5, deprecated) QAnyStringView | right(qsizetype n) const |
成员函数文档
[constexpr, since 6.5, deprecated]
QAnyStringView QAnyStringView::left(qsizetype n) const
该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
请在新代码中使用first() 代替它。
返回该对象中从位置 0 开始的长度为n 的子字符串。
如果n 大于或等于size() 或小于 0,则返回整个字符串视图。
此函数在 Qt 6.5 中引入。
另请参阅 first(),last(),sliced(),chopped(),chop(),truncate(),slice(), 和Sizes and Sub-Strings 。
[constexpr, since 6.5, deprecated]
QAnyStringView QAnyStringView::mid(qsizetype pos, qsizetype n = -1) const
该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
返回从pos 位置开始的长度为n 的子串。
在新代码中请使用sliced() 代替。
如果n 超过字符串视图的长度,则返回空字符串视图。如果从pos 开始的字符串视图中可用的代码点少于n ,或者n 为负值(默认值),该函数将返回从pos 开始的所有可用代码点。
该函数在 Qt 6.5 中引入。
另请参阅 first(),last(),sliced(),chopped(),chop(),truncate(),slice() 和Sizes and Sub-Strings 。
[constexpr, since 6.5, deprecated]
QAnyStringView QAnyStringView::right(qsizetype n) const
该函数已被弃用。我们强烈建议不要在新代码中使用该函数。
请在新代码中使用last() 代替它。
返回从size() -n 位置开始的长度为n 的子字符串。
如果n 大于或等于size() 或小于零,则返回整个字符串视图。
此函数在 Qt 6.5 中引入。
另请参阅 first(),last(),sliced(),chopped(),chop(),truncate(),slice() 和Sizes and Sub-Strings 。
© 2025 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.