QLatin1String 类

QLatin1String 类提供围绕 US-ASCII/Latin-1 编码字符串文字的瘦包裹器。 更多...

头: #include <QLatin1String>
qmake: QT += core

注意: 此类的所有函数 可重入 .

公共类型

(alias) const_iterator
(alias) const_reference
(alias) const_reverse_iterator
(alias) difference_type
(alias) iterator
(alias) reference
(alias) reverse_iterator
(alias) size_type
(alias) value_type

公共函数

QLatin1String (const QByteArray & str )
QLatin1String (const char * str , int size )
QLatin1String (const char * first , const char * last )
QLatin1String (const char * str )
QLatin1String ()
QString arg (Args &&... args ) const
QLatin1Char at (int pos ) const
QLatin1Char back () const
QLatin1String::const_iterator begin () const
QLatin1String::const_iterator cbegin () const
QLatin1String::const_iterator cend () const
void chop (int length )
QLatin1String chopped (int length ) const
int compare (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int compare (QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int compare (QChar ch ) const
int compare (QChar ch , Qt::CaseSensitivity cs ) const
bool contains (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains (QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool contains (QChar c , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
QLatin1String::const_reverse_iterator crbegin () const
QLatin1String::const_reverse_iterator crend () const
const char * data () const
QLatin1String::const_iterator end () const
bool endsWith (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith (QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool endsWith (QChar ch ) const
bool endsWith (QChar ch , Qt::CaseSensitivity cs ) const
QLatin1Char front () const
int indexOf (QStringView str , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf (QLatin1String l1 , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int indexOf (QChar c , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool isEmpty () const
bool isNull () const
int lastIndexOf (QStringView str , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf (QLatin1String l1 , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
int lastIndexOf (QChar c , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
const char * latin1 () const
QLatin1String left (int length ) const
QLatin1String mid (int start ) const
QLatin1String mid (int start , int length ) const
QLatin1String::const_reverse_iterator rbegin () const
QLatin1String::const_reverse_iterator rend () const
QLatin1String right (int length ) const
int size () const
bool startsWith (QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith (QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const
bool startsWith (QChar ch ) const
bool startsWith (QChar ch , Qt::CaseSensitivity cs ) const
QLatin1String trimmed () const
void truncate (int length )
bool operator!= (const QString & other ) const
bool operator!= (const char * other ) const
bool operator!= (const QByteArray & other ) const
bool operator< (const QString & other ) const
bool operator< (const char * other ) const
bool operator< (const QByteArray & other ) const
bool operator<= (const QString & other ) const
bool operator<= (const char * other ) const
bool operator<= (const QByteArray & other ) const
bool operator== (const QString & other ) const
bool operator== (const char * other ) const
bool operator== (const QByteArray & other ) const
bool operator> (const QString & other ) const
bool operator> (const char * other ) const
bool operator> (const QByteArray & other ) const
bool operator>= (const QString & other ) const
bool operator>= (const char * other ) const
bool operator>= (const QByteArray & other ) const
QLatin1Char operator[] (int pos ) const
bool operator!= (QLatin1String s1 , QLatin1String s2 )
bool operator< (QLatin1String s1 , QLatin1String s2 )
bool operator<= (QLatin1String s1 , QLatin1String s2 )
bool operator== (QLatin1String s1 , QLatin1String s2 )
bool operator> (QLatin1String s1 , QLatin1String s2 )
bool operator>= (QLatin1String s1 , QLatin1String s2 )

详细描述

许多 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() , replace() ,和 indexOf() . These functions are usually optimized to avoid constructing a QString object for the 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.

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 QLatin1String, which is just a very thin wrapper around a const char * . Using QLatin1String, the example code above becomes

if (str == QLatin1String("auto")
        || str == QLatin1String("extern")
        || str == QLatin1String("static")
        || str == QLatin1String("register") {
    ...
}
					

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 (QLatin1String) constructor, QLatin1String can be used everywhere a QString is expected. For example:

QLabel *label = new QLabel(QLatin1String("MOD"), this);
					

注意: If the function you're calling with a QLatin1String argument isn't actually overloaded to take QLatin1String, the implicit conversion to QString will trigger a memory allocation, which is usually what you want to avoid by using QLatin1String in the first place. In those cases, using QStringLiteral may be the better option.

另请参阅 QString , QLatin1Char , QStringLiteral ,和 QT_NO_CAST_FROM_ASCII .

成员类型文档编制

[alias] QLatin1String:: const_iterator

This is a type alias for iterator .

This alias was introduced in Qt 5.10.

另请参阅 iterator and const_reverse_iterator .

[alias] QLatin1String:: const_reference

This is a type alias for reference .

别名化的 reference . Provided for compatibility with the STL.

This alias was introduced in Qt 5.11.

[alias] QLatin1String:: const_reverse_iterator

This is a type alias for reverse_iterator .

This alias was introduced in Qt 5.10.

另请参阅 reverse_iterator and const_iterator .

[alias] QLatin1String:: difference_type

This is a type alias for int .

别名化的 int . Provided for compatibility with the STL.

This alias was introduced in Qt 5.10.

[alias] QLatin1String:: iterator

This is a type alias for value_type*.

QLatin1String does not support mutable iterators, so this is the same as const_iterator .

This alias was introduced in Qt 5.10.

另请参阅 const_iterator and reverse_iterator .

[alias] QLatin1String:: reference

This is a type alias for value_type&.

别名化的 value_type & . Provided for compatibility with the STL.

This alias was introduced in Qt 5.10.

[alias] QLatin1String:: reverse_iterator

This is a type alias for std::reverse_iterator<iterator>.

QLatin1String does not support mutable reverse iterators, so this is the same as const_reverse_iterator .

This alias was introduced in Qt 5.10.

另请参阅 const_reverse_iterator and iterator .

[alias] QLatin1String:: size_type

This is a type alias for int .

别名化的 int . Provided for compatibility with the STL.

This alias was introduced in Qt 5.10.

[alias] QLatin1String:: value_type

This is a type alias for const char.

别名化的 const char . Provided for compatibility with the STL.

This alias was introduced in Qt 5.10.

成员函数文档编制

template <typename Args> QString QLatin1String:: arg ( Args &&... args ) const

Replaces occurrences of %N in this string with the corresponding argument from args . The arguments are not positional: the first of the args replaces the %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 QLatin1String .

In addition, the following types are also supported: QChar , QLatin1Char .

该函数在 Qt 5.14 引入。

另请参阅 QString::arg ().

int QLatin1String:: lastIndexOf ( QChar c , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

int QLatin1String:: lastIndexOf ( QLatin1String l1 , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

int QLatin1String:: lastIndexOf ( QStringView str , int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

Returns the index position of the last occurrence of the string-view str , Latin-1 string l1 , or character ch , respectively, in this Latin-1 string, searching backward from index position from 。若 from is -1 (default), the search starts at the last character; if from is -2, at the next to last character and so on. Returns -1 if str 找不到。

cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.

该函数在 Qt 5.14 引入。

另请参阅 indexOf (), QStringView::lastIndexOf (), QStringView::indexOf (),和 QString::indexOf ().

bool QLatin1String:: contains ( QChar c , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

bool QLatin1String:: contains ( QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

bool QLatin1String:: contains ( QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

返回 true if this Latin-1 string contains an occurrence of the string-view str , Latin-1 string l1 , or character ch ;否则返回 false .

cs is Qt::CaseSensitive (the default), the search is case-sensitive; otherwise the search is case-insensitive.

该函数在 Qt 5.14 引入。

另请参阅 indexOf (), QStringView::contains (), QStringView::indexOf (),和 QString::indexOf ().

int QLatin1String:: indexOf ( QChar c , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

int QLatin1String:: indexOf ( QLatin1String l1 , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

int QLatin1String:: indexOf ( QStringView str , int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

Returns the index position of the first occurrence of the string-view str , Latin-1 string l1 , or character ch , respectively, in this Latin-1 string, searching forward from index position from . Returns -1 if str 找不到。

cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive.

from is -1, the search starts at the last character; if it is -2, at the next to last character and so on.

该函数在 Qt 5.14 引入。

另请参阅 QString::indexOf ().

bool QLatin1String:: endsWith ( QChar ch ) const

bool QLatin1String:: endsWith ( QChar ch , Qt::CaseSensitivity cs ) const

bool QLatin1String:: endsWith ( QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

bool QLatin1String:: endsWith ( QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

返回 true if this Latin-1 string ends with string-view str , Latin-1 string l1 , or character ch , respectively; otherwise returns false .

cs is Qt::CaseSensitive (the default), the search is case-sensitive; otherwise the search is case-insensitive.

该函数在 Qt 5.10 引入。

另请参阅 startsWith ().

bool QLatin1String:: startsWith ( QChar ch ) const

bool QLatin1String:: startsWith ( QChar ch , Qt::CaseSensitivity cs ) const

bool QLatin1String:: startsWith ( QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

bool QLatin1String:: startsWith ( QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

返回 true if this Latin-1 string starts with string-view str , Latin-1 string l1 , or character ch , respectively; otherwise returns false .

cs is Qt::CaseSensitive (the default), the search is case-sensitive; otherwise the search is case-insensitive.

该函数在 Qt 5.10 引入。

另请参阅 endsWith ().

int QLatin1String:: compare ( QChar ch ) const

int QLatin1String:: compare ( QChar ch , Qt::CaseSensitivity cs ) const

int QLatin1String:: compare ( QLatin1String l1 , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

int QLatin1String:: compare ( QStringView str , Qt::CaseSensitivity cs = Qt::CaseSensitive) const

Returns an integer that compares to zero as this Latin-1 string compares to the string-view str , Latin-1 string l1 , or character ch ,分别。

cs is Qt::CaseSensitive (the default), the comparison is case sensitive; otherwise the comparison is case-insensitive.

该函数在 Qt 5.14 引入。

另请参阅 operator== (), operator< (),和 operator> ().

QLatin1String:: QLatin1String (const QByteArray & str )

Constructs a QLatin1String 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 QLatin1String object exists.

另请参阅 latin1 ().

QLatin1String:: QLatin1String (const char * str , int size )

Constructs a QLatin1String 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 QLatin1String object exists.

另请参阅 latin1 ().

QLatin1String:: QLatin1String (const char * first , const char * last )

Constructs a QLatin1String object that stores first with length ( last - first ).

The range [first,last) must remain valid for the lifetime of this Latin-1 string object.

传递 nullptr as first is safe if last is nullptr , too, and results in a null Latin-1 string.

The behavior is undefined if last precedes first , first is nullptr and last is not, or if last - first > INT_MAX .

该函数在 Qt 5.10 引入。

QLatin1String:: QLatin1String (const char * str )

Constructs a QLatin1String 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 QLatin1String object exists.

另请参阅 latin1 ().

QLatin1String:: QLatin1String ()

Constructs a QLatin1String object that stores a nullptr.

该函数在 Qt 5.6 引入。

QLatin1Char QLatin1String:: at ( int pos ) const

返回字符位于位置 pos 在此对象。

注意: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size ().

该函数在 Qt 5.8 引入。

另请参阅 operator[] ().

QLatin1Char QLatin1String:: back () const

Returns the last character in the string. Same as at(size() - 1) .

This function is provided for STL compatibility.

警告: Calling this function on an empty string constitutes undefined behavior.

该函数在 Qt 5.10 引入。

另请参阅 front (), at (),和 operator[] ().

QLatin1String::const_iterator QLatin1String:: begin () const

返回常量 STL 样式迭代器 pointing to the first character in the string.

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 end (), cbegin (), rbegin (),和 data ().

QLatin1String::const_iterator QLatin1String:: cbegin () const

如同 begin ().

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 cend (), begin (), crbegin (),和 data ().

QLatin1String::const_iterator QLatin1String:: cend () const

如同 end ().

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 cbegin (), end (),和 crend ().

void QLatin1String:: chop ( int length )

Truncates this string by length 字符。

如同 *this = left(size() - length) .

注意: The behavior is undefined when length < 0 or length > size ().

该函数在 Qt 5.10 引入。

另请参阅 mid (), left (), right (), chopped (),和 truncate ().

QLatin1String QLatin1String:: chopped ( int length ) const

Returns the substring of length size () - length starting at the beginning of this object.

如同 left(size() - length) .

注意: The behavior is undefined when length < 0 or length > size ().

该函数在 Qt 5.10 引入。

另请参阅 mid (), left (), right (), chop (),和 truncate ().

QLatin1String::const_reverse_iterator QLatin1String:: crbegin () const

如同 rbegin ().

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 crend (), rbegin (),和 cbegin ().

QLatin1String::const_reverse_iterator QLatin1String:: crend () const

如同 rend ().

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 crbegin (), rend (),和 cend ().

const char *QLatin1String:: data () const

Returns the Latin-1 string stored in this object.

QLatin1String::const_iterator QLatin1String:: end () const

返回常量 STL 样式迭代器 pointing to the imaginary character after the last character in the list.

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 begin (), cend (),和 rend ().

QLatin1Char QLatin1String:: front () const

Returns the first character in the string. Same as at(0) .

This function is provided for STL compatibility.

警告: Calling this function on an empty string constitutes undefined behavior.

该函数在 Qt 5.10 引入。

另请参阅 back (), at (),和 operator[] ().

bool QLatin1String:: isEmpty () const

Returns whether the Latin-1 string stored in this object is empty ( size() == 0 ) or not.

该函数在 Qt 5.10 引入。

另请参阅 isNull () 和 size ().

bool QLatin1String:: isNull () const

Returns whether the Latin-1 string stored in this object is null ( data() == nullptr ) or not.

该函数在 Qt 5.10 引入。

另请参阅 isEmpty () 和 data ().

const char *QLatin1String:: latin1 () const

Returns the Latin-1 string stored in this object.

QLatin1String QLatin1String:: left ( int length ) const

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

注意: This function performs no error checking. The behavior is undefined when length < 0 or length > size ().

该函数在 Qt 5.8 引入。

另请参阅 mid (), right (), chopped (), chop (),和 truncate ().

QLatin1String QLatin1String:: mid ( int start ) const

Returns the substring starting at position start in this object, and extending to the end of the string.

注意: This function performs no error checking. The behavior is undefined when start < 0 or start > size ().

该函数在 Qt 5.8 引入。

另请参阅 left (), right (), chopped (), chop (),和 truncate ().

QLatin1String QLatin1String:: mid ( int start , int length ) const

这是重载函数。

Returns the substring of length length starting at position start 在此对象。

注意: This function performs no error checking. The behavior is undefined when start < 0, length < 0, or start + length > size ().

该函数在 Qt 5.8 引入。

另请参阅 left (), right (), chopped (), chop (),和 truncate ().

QLatin1String::const_reverse_iterator QLatin1String:: rbegin () const

返回常量 STL-style reverse iterator pointing to the first character in the string, in reverse order.

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 rend (), crbegin (),和 begin ().

QLatin1String::const_reverse_iterator QLatin1String:: rend () const

返回 STL-style reverse iterator pointing to one past the last character in the string, in reverse order.

This function is provided for STL compatibility.

该函数在 Qt 5.10 引入。

另请参阅 rbegin (), crend (),和 end ().

Returns the substring of length length starting at position size () - length 在此对象。

注意: This function performs no error checking. The behavior is undefined when length < 0 or length > size ().

该函数在 Qt 5.8 引入。

另请参阅 mid (), left (), chopped (), chop (),和 truncate ().

int QLatin1String:: size () const

Returns the size of the Latin-1 string stored in this object.

QLatin1String QLatin1String:: trimmed () const

Strips leading and trailing whitespace and returns the result.

Whitespace means any character for which QChar::isSpace () 返回 true . This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.

该函数在 Qt 5.10 引入。

void QLatin1String:: truncate ( int length )

Truncates this string to length length .

如同 *this = left(length) .

注意: The behavior is undefined when length < 0 or length > size ().

该函数在 Qt 5.10 引入。

另请参阅 mid (), left (), right (), chopped (),和 chop ().

bool QLatin1String:: operator!= (const QString & other ) const

返回 true if this string is not equal to string other ;否则返回 false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator!= (const char * other ) const

This function overloads operator!=().

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator!= (const QByteArray & other ) const

This function overloads operator!=().

other byte array is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator< (const QString & other ) const

返回 true if this string is lexically less than the other string; otherwise returns false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator< (const char * other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator< (const QByteArray & other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator<= (const QString & other ) const

返回 true if this string is lexically less than or equal to string other ;否则返回 false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator<= (const char * other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator<= (const QByteArray & other ) const

这是重载函数。

other array is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator== (const QString & other ) const

返回 true if this string is equal to string other ;否则返回 false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator== (const char * other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator== (const QByteArray & other ) const

这是重载函数。

other byte array is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator> (const QString & other ) const

返回 true if this string is lexically greater than string other ;否则返回 false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator> (const char * other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator> (const QByteArray & other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator>= (const QString & other ) const

返回 true if this string is lexically greater than or equal to string other ;否则返回 false .

另请参阅 Comparing Strings .

bool QLatin1String:: operator>= (const char * other ) const

这是重载函数。

other const char pointer is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 4.3 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

bool QLatin1String:: operator>= (const QByteArray & other ) const

这是重载函数。

other array is converted to a QString 使用 QString::fromUtf8 () 函数。

可以禁用此运算符通过定义 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.

该函数在 Qt 5.0 引入。

另请参阅 QT_NO_CAST_FROM_ASCII .

QLatin1Char QLatin1String:: operator[] ( int pos ) const

返回字符位于位置 pos 在此对象。

注意: This function performs no error checking. The behavior is undefined when pos < 0 or pos >= size ().

该函数在 Qt 5.8 引入。

另请参阅 at ().

相关非成员

bool operator!= ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 is lexically unequal to string s2 ;否则返回 false .

bool operator< ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 is lexically smaller than string s2 ;否则返回 false .

bool operator<= ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 is lexically smaller than or equal to string s2 ;否则返回 false .

bool operator== ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 is lexically equal to string s2 ;否则返回 false .

bool operator> ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 词法上大于字符串 s2 ;否则返回 false .

bool operator>= ( QLatin1String s1 , QLatin1String s2 )

返回 true 若字符串 s1 词法上大于等于字符串 s2 ;否则返回 false .