The QLatin1StringView class provides a thin wrapper around a US-ASCII/Latin-1 encoded string literal. 更多...
| 頭: |
#include <QLatin1StringView>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
|
| qmake: |
QT += core
|
此類 強烈可比較 .
此類 強烈可比較 采用 char16_t, QChar , QStringView , QUtf8StringView , QString , and const char16_t *.
此類 強烈可比較 with const char *, QByteArray ,和 QByteArrayView .
The byte array data is interpreted as UTF-8.
注意: 此類的所有函數 可重入 .
| const_iterator | |
(從 6.7 起)
|
const_pointer |
| const_reference | |
| const_reverse_iterator | |
| difference_type | |
| iterator | |
(從 6.7 起)
|
pointer |
| reference | |
| reverse_iterator | |
| size_type | |
| value_type |
| QLatin1StringView () | |
(從 6.3 起)
|
QLatin1StringView (QByteArrayView str ) |
| QLatin1StringView (const QByteArray & str ) | |
| QLatin1StringView (const char * str ) | |
(從 6.4 起)
|
QLatin1StringView (std::nullptr_t) |
| QLatin1StringView (const char * first , const char * last ) | |
| QLatin1StringView (const char * str , qsizetype size ) | |
| QString | arg (Args &&... args ) const |
| QLatin1Char | at (qsizetype pos ) const |
| QLatin1Char | back () const |
| QLatin1StringView::const_iterator | begin () const |
| QLatin1StringView::const_iterator | cbegin () const |
| QLatin1StringView::const_iterator | cend () const |
| void | chop (qsizetype length ) |
| QLatin1StringView | chopped (qsizetype length ) const |
| int | compare (QChar ch ) const |
| int | compare (QChar ch , Qt::CaseSensitivity cs ) const |
| int | compare (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| int | compare (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.5 起)
int
|
compare (QUtf8StringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
const char *
|
constBegin () const |
(從 6.4 起)
const char *
|
constData () const |
(從 6.4 起)
const char *
|
constEnd () const |
| bool | contains (QChar c , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| bool | contains (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| bool | contains (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
qsizetype
|
count (QChar ch , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
qsizetype
|
count (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
qsizetype
|
count (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| QLatin1StringView::const_reverse_iterator | crbegin () const |
| QLatin1StringView::const_reverse_iterator | crend () const |
| const char * | data () const |
(從 6.4 起)
bool
|
empty () const |
| QLatin1StringView::const_iterator | end () const |
| bool | endsWith (QChar ch ) const |
| bool | endsWith (QChar ch , Qt::CaseSensitivity cs ) const |
| bool | endsWith (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| bool | endsWith (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
QLatin1Char
|
first () const |
(從 6.0 起)
QLatin1StringView
|
first (qsizetype n ) const |
| QLatin1Char | front () const |
| qsizetype | indexOf (QChar c , qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| qsizetype | indexOf (QLatin1StringView l1 , qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| qsizetype | indexOf (QStringView str , qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| bool | isEmpty () const |
| bool | isNull () const |
(從 6.4 起)
QLatin1Char
|
last () const |
(從 6.0 起)
QLatin1StringView
|
last (qsizetype n ) const |
| qsizetype | lastIndexOf (QChar c , qsizetype from , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| qsizetype | lastIndexOf (QLatin1StringView l1 , qsizetype from , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| qsizetype | lastIndexOf (QStringView str , qsizetype from , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.3 起)
qsizetype
|
lastIndexOf (QChar ch , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.2 起)
qsizetype
|
lastIndexOf (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.2 起)
qsizetype
|
lastIndexOf (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| const char * | latin1 () const |
| QLatin1StringView | left (qsizetype length ) const |
(從 6.4 起)
qsizetype
|
length () const |
(從 6.8 起)
qsizetype
|
max_size () const |
| QLatin1StringView | mid (qsizetype start , qsizetype length = -1) const |
| QLatin1StringView::const_reverse_iterator | rbegin () const |
| QLatin1StringView::const_reverse_iterator | rend () const |
| QLatin1StringView | right (qsizetype length ) const |
| qsizetype | size () const |
(從 6.8 起)
QLatin1StringView &
|
slice (qsizetype pos ) |
(從 6.8 起)
QLatin1StringView &
|
slice (qsizetype pos , qsizetype n ) |
(從 6.0 起)
QLatin1StringView
|
sliced (qsizetype pos ) const |
(從 6.0 起)
QLatin1StringView
|
sliced (qsizetype pos , qsizetype n ) const |
| bool | startsWith (QChar ch ) const |
| bool | startsWith (QChar ch , Qt::CaseSensitivity cs ) const |
| bool | startsWith (QLatin1StringView l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
| bool | startsWith (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const |
(從 6.4 起)
double
|
toDouble (bool * ok = nullptr) const |
(從 6.4 起)
float
|
toFloat (bool * ok = nullptr) const |
(從 6.4 起)
int
|
toInt (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
long
|
toLong (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
qlonglong
|
toLongLong (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
short
|
toShort (bool * ok = nullptr, int base = 10) const |
(從 6.0 起)
QString
|
toString () const |
(從 6.4 起)
uint
|
toUInt (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
ulong
|
toULong (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
qulonglong
|
toULongLong (bool * ok = nullptr, int base = 10) const |
(從 6.4 起)
ushort
|
toUShort (bool * ok = nullptr, int base = 10) const |
(從 6.0 起)
auto
|
tokenize (Needle && sep , Flags... flags ) const |
| QLatin1StringView | trimmed () const |
| void | truncate (qsizetype length ) |
| QLatin1Char | operator[] (qsizetype pos ) const |
(從 6.8 起)
qsizetype
|
maxSize () |
| bool | operator!= (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator!= (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator!= (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator!= (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator!= (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator!= (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator!= (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator!= (const QLatin1StringView & lhs , const QByteArray & rhs ) |
(從 6.4 起)
QLatin1StringView
|
operator""_L1 (const char * str , size_t size ) |
| bool | operator< (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator< (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator< (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator< (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator< (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator< (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator< (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator< (const QLatin1StringView & lhs , const QByteArray & rhs ) |
| bool | operator<= (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator<= (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator<= (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator<= (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator<= (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator<= (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator<= (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator<= (const QLatin1StringView & lhs , const QByteArray & rhs ) |
| bool | operator== (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator== (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator== (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator== (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator== (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator== (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator== (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator== (const QLatin1StringView & lhs , const QByteArray & rhs ) |
| bool | operator> (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator> (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator> (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator> (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator> (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator> (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator> (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator> (const QLatin1StringView & lhs , const QByteArray & rhs ) |
| bool | operator>= (const QChar & lhs , const QLatin1StringView & rhs ) |
| bool | operator>= (const QLatin1StringView & lhs , const QChar & rhs ) |
| bool | operator>= (const QLatin1StringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator>= (const QLatin1StringView & lhs , const QStringView & rhs ) |
| bool | operator>= (const QLatin1StringView & lhs , const char *const & rhs ) |
| bool | operator>= (const QStringView & lhs , const QLatin1StringView & rhs ) |
| bool | operator>= (const char *const & lhs , const QLatin1StringView & rhs ) |
| bool | operator>= (const QLatin1StringView & lhs , const QByteArray & rhs ) |
很多
QString
's member functions are overloaded to accept
const char *
而不是
QString
. This includes the copy constructor, the assignment operator, the comparison operators, and various other functions such as
insert
(),
append
(),和
prepend
(). Some of these functions are optimized to avoid constructing a
QString
對象為
const char *
data. For example, assuming
str
是
QString
,
if (str == "auto" || str == "extern" || str == "static" || str == "register") { ... }
is much faster than
if (str == QString("auto") || str == QString("extern") || str == QString("static") || str == QString("register")) { ... }
because it doesn't construct four temporary QString objects and make a deep copy of the character data.
However, that is not true for all
QString
member functions that take
const char *
and therefore applications should assume a temporary will be created, such as in
str.append("Hello ").append("World");
Applications that define
QT_NO_CAST_FROM_ASCII
(as explained in the
QString
documentation) don't have access to
QString
's
const char *
API. To provide an efficient way of specifying constant Latin-1 strings, Qt provides the QLatin1StringView, which is just a very thin wrapper around a
const char *
. Using QLatin1StringView, the example code above becomes
// Required for using the '_L1' string literal. using namespace Qt::StringLiterals; // ... if (str == "auto"_L1 || str == "extern"_L1 || str == "static"_L1 || str == "register"_L1 { ... }
This is a bit longer to type, but it provides exactly the same benefits as the first version of the code, and is faster than converting the Latin-1 strings using QString::fromLatin1 ().
Thanks to the QString (QLatin1StringView) constructor, QLatin1StringView can be used everywhere a QString is expected. For example:
QLabel *label = new QLabel("MOD"_L1, this);
注意: If the function you're calling with a QLatin1StringView argument isn't actually overloaded to take QLatin1StringView, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1StringView in the first place. In those cases, using QStringLiteral may be the better option.
注意:
Only US-ASCII literals can be used in QLatin1StringView if the source code file is encoded in UTF-8, as
Qt 要求
. Non-US-ASCII literals like
QLatin1StringView("é")
will not be represented correctly. You can use octal or hex notation instead:
QLatin1StringView("\351")
or
QLatin1StringView("\xe9")
,分彆。
另請參閱 QString , QLatin1Char , QStringLiteral ,和 QT_NO_CAST_FROM_ASCII .
[alias, since 6.7]
QLatin1StringView::
const_pointer
[alias, since 6.7]
QLatin1StringView::
pointer
彆名化的
value_type *
。為兼容 STL (標準模闆庫) 提供。
該 typedef 在 Qt 6.7 引入。
[alias]
QLatin1StringView::
const_iterator
另請參閱 iterator and const_reverse_iterator .
[alias]
QLatin1StringView::
const_reference
彆名化的
reference
。為兼容 STL (標準模闆庫) 提供。
[alias]
QLatin1StringView::
const_reverse_iterator
另請參閱 reverse_iterator and const_iterator .
[alias]
QLatin1StringView::
difference_type
彆名化的
qsizetype
。為兼容 STL (標準模闆庫) 提供。
[alias]
QLatin1StringView::
iterator
QLatin1StringView does not support mutable iterators, so this is the same as const_iterator .
另請參閱 const_iterator and reverse_iterator .
[alias]
QLatin1StringView::
reference
彆名化的
value_type &
。為兼容 STL (標準模闆庫) 提供。
[alias]
QLatin1StringView::
reverse_iterator
QLatin1StringView does not support mutable reverse iterators, so this is the same as const_reverse_iterator .
另請參閱 const_reverse_iterator and iterator .
[alias]
QLatin1StringView::
size_type
彆名化的
qsizetype
。為兼容 STL (標準模闆庫) 提供。
注意:
In version prior to Qt 6, this was an alias for
int
, restricting the amount of data that could be held in a
QLatin1StringView
on 64-bit architectures.
[alias]
QLatin1StringView::
value_type
彆名化的
const char
。為兼容 STL (標準模闆庫) 提供。
[constexpr noexcept]
int
QLatin1StringView::
compare
(
QChar
ch
) const
[noexcept]
int
QLatin1StringView::
compare
(
QChar
ch
,
Qt::CaseSensitivity
cs
) const
[noexcept]
int
QLatin1StringView::
compare
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
int
QLatin1StringView::
compare
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
Compares this string view with UTF-16 string view str , Latin-1 string view l1 , or the character ch , respectively. Returns a negative integer if this string is less than str , l1 or ch , returns a positive integer if it is greater than str , l1 or ch ,和 0 若它們相等。
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
另請參閱 operator== (), operator< (),和 operator> ().
[constexpr noexcept]
bool
QLatin1StringView::
startsWith
(
QChar
ch
) const
[noexcept]
bool
QLatin1StringView::
startsWith
(
QChar
ch
,
Qt::CaseSensitivity
cs
) const
[noexcept]
bool
QLatin1StringView::
startsWith
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
bool
QLatin1StringView::
startsWith
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
返迴
true
if this Latin-1 string view starts with the UTF-16 string viewed by
str
, the Latin-1 string viewed by
l1
, or the character
ch
, respectively; otherwise returns
false
.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
另請參閱 endsWith ().
[constexpr noexcept]
bool
QLatin1StringView::
endsWith
(
QChar
ch
) const
[noexcept]
bool
QLatin1StringView::
endsWith
(
QChar
ch
,
Qt::CaseSensitivity
cs
) const
[noexcept]
bool
QLatin1StringView::
endsWith
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
bool
QLatin1StringView::
endsWith
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
返迴
true
if this Latin-1 string view ends with the UTF-16 string viewed
str
, the Latin-1 string viewed by
l1
, or the character
ch
, respectively; otherwise returns
false
.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
另請參閱 startsWith ().
[noexcept]
qsizetype
QLatin1StringView::
indexOf
(
QChar
c
,
qsizetype
from
= 0,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
qsizetype
QLatin1StringView::
indexOf
(
QLatin1StringView
l1
,
qsizetype
from
= 0,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
qsizetype
QLatin1StringView::
indexOf
(
QStringView
str
,
qsizetype
from
= 0,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
Returns the index position in this Latin-1 string view of the first occurrence of the UTF-16 string viewed by str , the Latin-1 string viewed by l1 , or the character ch , respectively, searching forward from index position from . Returns -1 if str , l1 or c is not found, respectively.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
若 from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
另請參閱 QString::indexOf ().
[noexcept]
bool
QLatin1StringView::
contains
(
QChar
c
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
bool
QLatin1StringView::
contains
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
bool
QLatin1StringView::
contains
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
返迴
true
if this Latin-1 string view contains an occurrence of the UTF-16 string viewed by
str
, the Latin-1 string viewed by
l1
, or the character
ch
, respectively; otherwise returns
false
.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
另請參閱 indexOf (), QStringView::contains (), QStringView::indexOf (),和 QString::indexOf ().
[noexcept]
qsizetype
QLatin1StringView::
lastIndexOf
(
QChar
c
,
qsizetype
from
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
qsizetype
QLatin1StringView::
lastIndexOf
(
QLatin1StringView
l1
,
qsizetype
from
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept]
qsizetype
QLatin1StringView::
lastIndexOf
(
QStringView
str
,
qsizetype
from
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
Returns the index position in this Latin-1 string view of the last occurrence of the UTF-16 string viewed by str , the Latin-1 string viewed by l1 , or the character ch , respectively, searching backward from index position from ; returns -1 if str , l1 or ch is not found, respectively.
若 from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
注意:
When searching for a 0-length
str
or
l1
, the match at the end of the data is excluded from the search by a negative
from
, even though
-1
is normally thought of as searching from the end of the string: the match at the end is
after
the last character, so it is excluded. To include such a final empty match, either give a positive value for
from
or omit the
from
parameter entirely.
另請參閱 indexOf (), QStringView::lastIndexOf (), QStringView::indexOf (),和 QString::indexOf ().
[noexcept, since 6.2]
qsizetype
QLatin1StringView::
lastIndexOf
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[noexcept, since 6.2]
qsizetype
QLatin1StringView::
lastIndexOf
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
此函數重載 lastIndexOf ().
Returns the index position in this Latin-1 string view of the last occurrence of the UTF-16 string viewed by str or the Latin-1 string viewed by l1 , respectively. Returns -1 if str or l1 is not found, respectively.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
該函數在 Qt 6.2 引入。
[noexcept, since 6.4]
qsizetype
QLatin1StringView::
count
(
QChar
ch
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[since 6.4]
qsizetype
QLatin1StringView::
count
(
QLatin1StringView
l1
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
[since 6.4]
qsizetype
QLatin1StringView::
count
(
QStringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
Returns the number of (potentially overlapping) occurrences of the UTF-16 string viewed by str , the Latin-1 string viewed by l1 , or the character ch , respectively, in this string view.
若 cs is Qt::CaseSensitive (默認),搜索區分大小寫;否則,搜索不區分大小寫。
該函數在 Qt 6.4 引入。
另請參閱 contains () 和 indexOf ().
[since 6.4]
int
QLatin1StringView::
toInt
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
long
QLatin1StringView::
toLong
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
qlonglong
QLatin1StringView::
toLongLong
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
qulonglong
QLatin1StringView::
toULongLong
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
short
QLatin1StringView::
toShort
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
uint
QLatin1StringView::
toUInt
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
ulong
QLatin1StringView::
toULong
(
bool
*
ok
= nullptr,
int
base
= 10) const
[since 6.4]
ushort
QLatin1StringView::
toUShort
(
bool
*
ok
= nullptr,
int
base
= 10) const
Returns this QLatin1StringView converted to a corresponding numeric value using base base , which is ten by default. Bases 0 and 2 through 36 are supported, using letters for digits beyond 9; A is ten, B is eleven and so on.
若 base is 0, the base is determined automatically using the following rules (in this order), if the Latin-1 string view begins with:
"0x"
, the rest of it is read as hexadecimal (base 16)
"0b"
, the rest of it is read as binary (base 2)
"0"
, the rest of it is read as octal (base 8)
返迴 0,若轉換失敗。
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
注意: The conversion of the number is performed in the default C locale, regardless of the user's locale. Use QLocale to perform locale-aware conversions between numbers and strings.
This function ignores leading and trailing spacing characters.
注意: 在 Qt 6.4 添加對 0b 前綴的支持。
該函數在 Qt 6.4 引入。
[since 6.4]
double
QLatin1StringView::
toDouble
(
bool
*
ok
= nullptr) const
[since 6.4]
float
QLatin1StringView::
toFloat
(
bool
*
ok
= nullptr) const
Returns this QLatin1StringView converted to a corresponding floating-point value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
若
ok
不是
nullptr
, failure is reported by setting *
ok
to
false
, and success by setting *
ok
to
true
.
警告: The QLatin1StringView content may only contain valid numerical characters which includes the plus/minus sign, the character e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error.
注意: The conversion of the number is performed in the default C locale, regardless of the user's locale. Use QLocale to perform locale-aware conversions between numbers and strings.
This function ignores leading and trailing spacing characters.
該函數在 Qt 6.4 引入。
Replaces occurrences of
%N
in this string with the corresponding argument from
args
. The arguments are not positional: the first of the
args
替換
%N
with the lowest
N
(all of them), the second of the
args
the
%N
with the next-lowest
N
etc.
Args
can consist of anything that implicitly converts to
QString
,
QStringView
or
QLatin1StringView
.
In addition, the following types are also supported: QChar , QLatin1Char .
另請參閱 QString::arg ().
[constexpr noexcept(...), since 6.0]
template <typename Needle, typename... Flags>
auto
QLatin1StringView::
tokenize
(
Needle
&&
sep
,
Flags
...
flags
) const
Splits the string into substring views wherever sep occurs, and returns a lazy sequence of those strings.
相當於
return QStringTokenizer{std::forward<Needle>(sep), flags...};
except it works without C++17 Class Template Argument Deduction (CTAD) enabled in the compiler.
見 QStringTokenizer for how sep and flags interact to form the result.
注意: While this function returns QStringTokenizer , you should never, ever, name its template arguments explicitly. If you can use C++17 Class Template Argument Deduction (CTAD), you may write
QStringTokenizer result = sv.tokenize(sep);
(without template arguments). If you can't use C++17 CTAD, you must store the return value only in
auto
變量:
auto result = sv.tokenize(sep);
This is because the template arguments of QStringTokenizer have a very subtle dependency on the specific tokenize () overload from which they are returned, and they don't usually correspond to the type used for the separator.
該函數在 Qt 6.0 引入。
注意:
This function is noexcept when
noexcept(qTokenize(std::declval<const QLatin1StringView &>(),std::forward<Needle>(needle), flags...))
is
true
.
另請參閱 QStringTokenizer and qTokenize ().
[constexpr noexcept]
QLatin1StringView::
QLatin1StringView
()
Constructs a QLatin1StringView object that stores a
nullptr
.
另請參閱 data (), isEmpty (), isNull (),和 null 和空字符串之間的區彆 .
[explicit constexpr noexcept, since 6.3]
QLatin1StringView::
QLatin1StringView
(
QByteArrayView
str
)
Constructs a QLatin1StringView object as a view on str .
The string data is not copied. The caller must be able to guarantee that the data which str is pointing to will not be deleted or modified as long as the QLatin1StringView object exists. The size is obtained from str as-is, without checking for a null-terminator.
注意: : any null ('\0') bytes in the byte array will be included in this string, which will be converted to Unicode null characters (U+0000) if this string is used by QString .
該函數在 Qt 6.3 引入。
另請參閱 latin1 ().
[explicit noexcept]
QLatin1StringView::
QLatin1StringView
(const
QByteArray
&
str
)
Constructs a QLatin1StringView object as a view on str .
The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1StringView object exists.
另請參閱 latin1 ().
[explicit constexpr noexcept]
QLatin1StringView::
QLatin1StringView
(const
char
*
str
)
Constructs a QLatin1StringView object that stores str .
The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1StringView object exists.
另請參閱 latin1 ().
[constexpr noexcept, since 6.4]
QLatin1StringView::
QLatin1StringView
(
std::nullptr_t
)
Constructs a QLatin1StringView object that stores a
nullptr
.
該函數在 Qt 6.4 引入。
另請參閱 data (), isEmpty (), isNull (),和 null 和空字符串之間的區彆 .
[constexpr]
QLatin1StringView::
QLatin1StringView
(const
char
*
first
, const
char
*
last
)
Constructs a QLatin1StringView object that stores first 按長度 ( last - first ).
範圍
[first,last)
must remain valid for the lifetime of this Latin-1 string object.
傳遞
nullptr
as
first
是安全的若
last
is
nullptr
, too, and results in a null Latin-1 string.
行為未定義若
last
precedes
first
,
first
is
nullptr
and
last
is not, or if
last - first > INT_MAX
.
[constexpr noexcept]
QLatin1StringView::
QLatin1StringView
(const
char
*
str
,
qsizetype
size
)
Constructs a QLatin1StringView object that stores str with size .
The string data is not copied. The caller must be able to guarantee that str will not be deleted or modified as long as the QLatin1StringView object exists.
注意: : any null ('\0') bytes in the byte array will be included in this string, which will be converted to Unicode null characters (U+0000) if this string is used by QString . This behavior is different from Qt 5.x.
另請參閱 latin1 ().
[constexpr]
QLatin1Char
QLatin1StringView::
at
(
qsizetype
pos
) const
返迴字符位於位置 pos 在此對象。
注意: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size ().
另請參閱 operator[] ().
[constexpr]
QLatin1Char
QLatin1StringView::
back
() const
返迴字符串中的最後一個字符。如同
at(size() - 1)
.
此函數為兼容 STL (標準模闆庫) 提供。
警告: 在空字符串調用此函數,將構成未定義行為。
另請參閱 front (), at (),和 operator[] ().
[constexpr noexcept]
QLatin1StringView::const_iterator
QLatin1StringView::
begin
() const
返迴常量 STL 樣式迭代器 指嚮字符串中的首個字符。
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 end (), cbegin (), rbegin (),和 data ().
[constexpr noexcept]
QLatin1StringView::const_iterator
QLatin1StringView::
cbegin
() const
如同 begin ().
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 cend (), begin (), crbegin (),和 data ().
[constexpr noexcept]
QLatin1StringView::const_iterator
QLatin1StringView::
cend
() const
如同 end ().
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 cbegin (), end (),和 crend ().
[constexpr]
void
QLatin1StringView::
chop
(
qsizetype
length
)
Truncates this string by length 字符。
如同
*this = left(size() - length)
.
注意: 行為未定義當 length < 0 or length > size ().
另請參閱 sliced (), first (), last (), chopped (), truncate (),和 slice ().
[constexpr]
QLatin1StringView
QLatin1StringView::
chopped
(
qsizetype
length
) const
返迴子字符串長度 size () - length 起始於此對象的開頭。
如同
left(size() - length)
.
注意: 行為未定義當 length < 0 or length > size ().
另請參閱 sliced (), first (), last (), chop (), truncate (),和 slice ().
[noexcept, since 6.5]
int
QLatin1StringView::
compare
(
QUtf8StringView
str
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
Compares this string view with str and returns a negative integer if this string view is less than str ,正整數若大於 str ,和 0 若它們相等。
若 cs is Qt::CaseSensitive (默認),比較區分大小寫;否則,比較不區分大小寫。
該函數在 Qt 6.5 引入。
另請參閱 operator== (), operator< (),和 operator> ().
[constexpr noexcept, since 6.4]
const
char
*QLatin1StringView::
constBegin
() const
如同 begin ().
This function is provided for compatibility with other Qt containers.
該函數在 Qt 6.4 引入。
另請參閱 constEnd (), begin (), cbegin (),和 data ().
[constexpr noexcept, since 6.4]
const
char
*QLatin1StringView::
constData
() const
Returns the start of the Latin-1 string referenced by this object.
This function is provided for compatibility with other Qt containers.
該函數在 Qt 6.4 引入。
另請參閱 data ().
[constexpr noexcept, since 6.4]
const
char
*QLatin1StringView::
constEnd
() const
如同 end ().
This function is provided for compatibility with other Qt containers.
該函數在 Qt 6.4 引入。
另請參閱 constBegin (), end (), cend (),和 crend ().
[noexcept]
QLatin1StringView::const_reverse_iterator
QLatin1StringView::
crbegin
() const
如同 rbegin ().
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 crend (), rbegin (),和 cbegin ().
[noexcept]
QLatin1StringView::const_reverse_iterator
QLatin1StringView::
crend
() const
如同 rend ().
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 crbegin (), rend (),和 cend ().
[constexpr noexcept]
const
char
*QLatin1StringView::
data
() const
Returns the start of the Latin-1 string referenced by this object.
[constexpr noexcept, since 6.4]
bool
QLatin1StringView::
empty
() const
Returns whether the Latin-1 string referenced by this object is empty (
size() == 0
) or not.
此函數為兼容 STL (標準模闆庫) 提供。
該函數在 Qt 6.4 引入。
另請參閱 isEmpty (), isNull (),和 size ().
[constexpr noexcept]
QLatin1StringView::const_iterator
QLatin1StringView::
end
() const
返迴常量 STL 樣式迭代器 僅僅指嚮字符串中最後一個字符的後麵。
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 begin (), cend (),和 rend ().
[constexpr, since 6.4]
QLatin1Char
QLatin1StringView::
first
() const
Returns the first character in the string. Same as
at(0)
or
front
().
This function is provided for compatibility with other Qt containers.
警告: 在空字符串調用此函數,將構成未定義行為。
該函數在 Qt 6.4 引入。
另請參閱 last (), front (),和 back ().
[constexpr, since 6.0]
QLatin1StringView
QLatin1StringView::
first
(
qsizetype
n
) const
Returns a Latin-1 string view that contains the first n characters of this string view.
注意: 行為未定義當 n < 0 or n > size ().
該函數在 Qt 6.0 引入。
另請參閱 last (), startsWith (), chopped (), chop (), truncate (),和 slice ().
[constexpr]
QLatin1Char
QLatin1StringView::
front
() const
Returns the first character in the string. Same as
at(0)
.
此函數為兼容 STL (標準模闆庫) 提供。
警告: 在空字符串調用此函數,將構成未定義行為。
另請參閱 back (), at (),和 operator[] ().
[constexpr noexcept]
bool
QLatin1StringView::
isEmpty
() const
Returns whether the Latin-1 string referenced by this object is empty (
size() == 0
) or not.
[constexpr noexcept]
bool
QLatin1StringView::
isNull
() const
Returns whether the Latin-1 string referenced by this object is null (
data() == nullptr
) or not.
[constexpr, since 6.4]
QLatin1Char
QLatin1StringView::
last
() const
返迴字符串中的最後一個字符。如同
at(size() - 1)
or
back
().
This function is provided for compatibility with other Qt containers.
警告: 在空字符串調用此函數,將構成未定義行為。
該函數在 Qt 6.4 引入。
另請參閱 first (), back (),和 front ().
[constexpr, since 6.0]
QLatin1StringView
QLatin1StringView::
last
(
qsizetype
n
) const
Returns a Latin-1 string view that contains the last n characters of this string view.
注意: 行為未定義當 n < 0 or n > size ().
該函數在 Qt 6.0 引入。
另請參閱 first (), endsWith (), chopped (), chop (), truncate (),和 slice ().
[noexcept, since 6.3]
qsizetype
QLatin1StringView::
lastIndexOf
(
QChar
ch
,
Qt::CaseSensitivity
cs
= Qt::CaseSensitive) const
這是重載函數。
該函數在 Qt 6.3 引入。
[constexpr noexcept]
const
char
*QLatin1StringView::
latin1
() const
Returns the start of the Latin-1 string referenced by this object.
[constexpr]
QLatin1StringView
QLatin1StringView::
left
(
qsizetype
length
) const
若知道 length 不可以超齣邊界,使用 first () 代替在新代碼中,因為它更快。
返迴子字符串長度 length starting at position 0 in this Latin-1 string view.
The entire Latin-1 string view is returned if length >= size (),或小於 0。
另請參閱 first (), last (), sliced (), startsWith (), chopped (), chop (), truncate (),和 slice ().
[constexpr noexcept, since 6.4]
qsizetype
QLatin1StringView::
length
() const
如同 size ().
This function is provided for compatibility with other Qt containers.
該函數在 Qt 6.4 引入。
[static constexpr noexcept, since 6.8]
qsizetype
QLatin1StringView::
maxSize
()
It returns the maximum number of elements that the string view can theoretically represent. In practice, the number can be much smaller, limited by the amount of memory available to the system.
該函數在 Qt 6.8 引入。
[constexpr noexcept, since 6.8]
qsizetype
QLatin1StringView::
max_size
() const
此函數為兼容 STL (標準模闆庫) 提供。
返迴 maxSize ().
該函數在 Qt 6.8 引入。
[constexpr]
QLatin1StringView
QLatin1StringView::
mid
(
qsizetype
start
,
qsizetype
length
= -1) const
返迴子字符串長度 length 起始於位置 start in this Latin-1 string view.
若知道 start and length 不可以超齣邊界,使用 sliced () 代替在新代碼中,因為它更快。
Returns an empty Latin-1 string view if start exceeds the length of this string view. If there are less than length characters available in this string view starting at start ,或者若 length is negative (default), the function returns all characters that are available from start .
另請參閱 first (), last (), sliced (), chopped (), chop (), truncate (),和 slice ().
[noexcept]
QLatin1StringView::const_reverse_iterator
QLatin1StringView::
rbegin
() const
返迴常量 STL-style reverse iterator pointing to the first character in the string, in reverse order.
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 rend (), crbegin (),和 begin ().
[noexcept]
QLatin1StringView::const_reverse_iterator
QLatin1StringView::
rend
() const
返迴 STL-style reverse iterator pointing just after the last character in the string, in reverse order.
此函數為兼容 STL (標準模闆庫) 提供。
另請參閱 rbegin (), crend (),和 end ().
[constexpr]
QLatin1StringView
QLatin1StringView::
right
(
qsizetype
length
) const
若知道 length 不可以超齣邊界,使用 last () 代替在新代碼中,因為它更快。
返迴子字符串長度 length 起始於位置 size () - length in this Latin-1 string view.
The entire Latin-1 string view is returned if length >= size (),或小於 0。
另請參閱 first (), last (), sliced (), endsWith (), chopped (), chop (), truncate (),和 slice ().
[constexpr noexcept]
qsizetype
QLatin1StringView::
size
() const
Returns the size of the Latin-1 string referenced by this object.
注意:
In version prior to Qt 6, this function returned
int
, restricting the amount of data that could be held in a
QLatin1StringView
on 64-bit architectures.
[constexpr, since 6.8]
QLatin1StringView
&QLatin1StringView::
slice
(
qsizetype
pos
)
Modifies this Latin-1 string view to start at position pos , extending to its end.
注意: 行為未定義當 pos < 0 or pos > size ().
該函數在 Qt 6.8 引入。
另請參閱 sliced (), first (), last (), chopped (), chop (),和 truncate ().
[constexpr, since 6.8]
QLatin1StringView
&QLatin1StringView::
slice
(
qsizetype
pos
,
qsizetype
n
)
這是重載函數。
Modifies this Latin-1 string view to start at position pos , extending for n 字符。
注意:
行為未定義當
pos
< 0,
n
< 0, or
pos + n > size()
.
該函數在 Qt 6.8 引入。
另請參閱 sliced (), first (), last (), chopped (), chop (),和 truncate ().
[constexpr, since 6.0]
QLatin1StringView
QLatin1StringView::
sliced
(
qsizetype
pos
) const
Returns a Latin-1 string view starting at position pos in this string view, and extending to its end.
注意: 行為未定義當 pos < 0 or pos > size ().
該函數在 Qt 6.0 引入。
另請參閱 first (), last (), chopped (), chop (), truncate (),和 slice ().
[constexpr, since 6.0]
QLatin1StringView
QLatin1StringView::
sliced
(
qsizetype
pos
,
qsizetype
n
) const
Returns a Latin-1 string view that points to n characters of this string view, starting at position pos .
注意:
行為未定義當
pos
< 0,
n
< 0, or
pos + n > size()
.
該函數在 Qt 6.0 引入。
另請參閱 first (), last (), chopped (), chop (), truncate (),和 slice ().
[since 6.0]
QString
QLatin1StringView::
toString
() const
Converts this Latin-1 string into a QString . Equivalent to
return QString(*this);
該函數在 Qt 6.0 引入。
[noexcept]
QLatin1StringView
QLatin1StringView::
trimmed
() const
Strips leading and trailing whitespace and returns the result.
空白意味著任何字符其。
QChar::isSpace
() 返迴
true
。這包括 ASCII 字符 \t、\n、\v、\f、\r、及 " "。
[constexpr]
void
QLatin1StringView::
truncate
(
qsizetype
length
)
Truncates this string to length length .
如同
*this = left(length)
.
注意: 行為未定義當 length < 0 or length > size ().
另請參閱 sliced (), first (), last (), chopped (),和 chop ().
[constexpr]
QLatin1Char
QLatin1StringView::
operator[]
(
qsizetype
pos
) const
返迴字符位於位置 pos 在此對象。
注意: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size ().
另請參閱 at ().
[noexcept]
bool
operator!=
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
is lexically not equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically not equal to char
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically not equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically not equal to string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is not equal to const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator!=
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
is lexically not equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
is lexically not equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator!=
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
This function overloads operator!=().
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
[constexpr noexcept, since 6.4]
QLatin1StringView
operator""_L1
(const
char
*
str
,
size_t
size
)
文字運算符創建的 QLatin1StringView out of the first size characters in the char string literal str .
以下代碼創建 QLatin1StringView :
using namespace Qt::Literals::StringLiterals; auto str = "hello"_L1;
該函數在 Qt 6.4 引入。
另請參閱 Qt::Literals::StringLiterals .
[noexcept]
bool
operator<
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
詞法上小於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically less than char
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
詞法上小於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically less than string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is lexically less than const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator<
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
詞法上小於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
詞法上小於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
這是重載函數。
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
[noexcept]
bool
operator<=
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
詞法上 <= 字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically less than or equal to char
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
詞法上 <= 字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically less than or equal to string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is lexically less than or equal to const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator<=
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
詞法上 <= 字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
詞法上 <= 字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator<=
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
這是重載函數。
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
[noexcept]
bool
operator==
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
is lexically equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically equal to char
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically equal to string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is equal to const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator==
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
is lexically equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
is lexically equal to string
rhs
;否則返迴
false
.
[noexcept]
bool
operator==
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
這是重載函數。
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
[noexcept]
bool
operator>
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
詞法上大於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically greater than char
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
詞法上大於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically greater than string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is lexically greater than const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator>
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
詞法上大於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
詞法上大於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
這是重載函數。
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
[noexcept]
bool
operator>=
(const
QChar
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if char
lhs
詞法上大於等於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
QLatin1StringView
&
lhs
, const
QChar
&
rhs
)
返迴
true
若字符串
lhs
is lexically greater than or equal to char
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
QLatin1StringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
若字符串
lhs
詞法上大於等於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
QLatin1StringView
&
lhs
, const
QStringView
&
rhs
)
返迴
true
若字符串
lhs
is lexically greater than or equal to string view
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
QLatin1StringView
&
lhs
, const
char
*const &
rhs
)
返迴
true
若字符串
lhs
is lexically greater than or equal to const char pointer
rhs
;否則返迴
false
.
The rhs const char pointer is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.
另請參閱 Comparing Strings .
[noexcept]
bool
operator>=
(const
QStringView
&
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if string view
lhs
詞法上大於等於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
char
*const &
lhs
, const
QLatin1StringView
&
rhs
)
返迴
true
if const char pointer
lhs
詞法上大於等於字符串
rhs
;否則返迴
false
.
[noexcept]
bool
operator>=
(const
QLatin1StringView
&
lhs
, const
QByteArray
&
rhs
)
這是重載函數。
The rhs byte array is converted to a QUtf8StringView .
可以禁用此運算符通過定義 QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr (), for example.