このページでは

QLatin1StringView Class

QLatin1StringView クラスは、US-ASCII/Latin-1 エンコードされた文字列リテラルをラップするシンプルなラッパーを提供します。詳細...

ヘッダー: #include <QLatin1StringView>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

注:このクラスのすべての関数は再入可能です。

QLatin1StringView の比較

カテゴリ比較可能な型説明
strongQLatin1StringView
strongchar16_t、QChar 、QStringView 、QUtf8StringView 、QString 、および const char16_t *。
strongconst char *、QByteArray 、およびQByteArrayView 。バイト配列データは UTF-8 として解釈されます。

パブリック型

パブリック関数

QLatin1StringView()
(since 6.3) QLatin1StringView(QByteArrayView str)
QLatin1StringView(const QByteArray &str)
QLatin1StringView(const char *str)
(since 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
(since 6.5) int compare(QUtf8StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) const char *constBegin() const
(since 6.4) const char *constData() const
(since 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
(since 6.4) qsizetype count(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.4) qsizetype count(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 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
(since 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
(since 6.4) QLatin1Char first() const
(since 6.0) QLatin1StringView first(qsizetype n) const
QLatin1Char front() const
qsizetype indexOf(QChar c, qsizetype from = 0) const
qsizetype indexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) 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
(since 6.4) QLatin1Char last() const
(since 6.0) QLatin1StringView last(qsizetype n) const
qsizetype lastIndexOf(QChar c) const
(since 6.3) qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const
qsizetype lastIndexOf(QChar c, qsizetype from) const
qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) 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
(since 6.2) qsizetype lastIndexOf(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
(since 6.2) qsizetype lastIndexOf(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
const char *latin1() const
QLatin1StringView left(qsizetype length) const
(since 6.4) qsizetype length() const
(since 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
(since 6.8) QLatin1StringView &slice(qsizetype pos)
(since 6.8) QLatin1StringView &slice(qsizetype pos, qsizetype n)
(since 6.0) QLatin1StringView sliced(qsizetype pos) const
(since 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
(since 6.4) double toDouble(bool *ok = nullptr) const
(since 6.4) float toFloat(bool *ok = nullptr) const
(since 6.4) int toInt(bool *ok = nullptr, int base = 10) const
(since 6.4) long toLong(bool *ok = nullptr, int base = 10) const
(since 6.4) qlonglong toLongLong(bool *ok = nullptr, int base = 10) const
(since 6.4) short toShort(bool *ok = nullptr, int base = 10) const
(since 6.0) QString toString() const
(since 6.4) uint toUInt(bool *ok = nullptr, int base = 10) const
(since 6.4) ulong toULong(bool *ok = nullptr, int base = 10) const
(since 6.4) qulonglong toULongLong(bool *ok = nullptr, int base = 10) const
(since 6.4) ushort toUShort(bool *ok = nullptr, int base = 10) const
(since 6.9) QByteArray toUtf8() const
(since 6.0) auto tokenize(Needle &&sep, Flags... flags) const
QLatin1StringView trimmed() const
void truncate(qsizetype length)
QLatin1Char operator[](qsizetype pos) const

静的パブリックメンバー

(since 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)
(since 6.4) QLatin1StringView operator""_L1(const char*str, size_tsize)
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<=bool(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 のメンバ関数の多くは、QString の代わりにconst char * を受け入れるようにオーバーロードされています。これには、コピーコンストラクタ、代入演算子、比較演算子、およびinsert()、append()、prepend()などのさまざまな関数が含まれます。これらの関数の一部は、const char * データに対してQString オブジェクトを構築することを回避するように最適化されています。たとえば、str がQString であると仮定すると、

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

は、

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

の方がはるかに高速です。これは、4つのQString の一時オブジェクトを生成して、文字データのディープコピーを作成する必要がないためです。

ただし、これはconst char * を受け取るすべてのQString のメンバ関数に当てはまるわけではないため、アプリケーションでは、次のような場合と同様に、一時オブジェクトが作成されることを想定する必要があります。

str.append("Hello ").append("World");

QT_NO_CAST_FROM_ASCII を定義するアプリケーション(QString のドキュメントで説明されている通り)は、QString のconst char * APIにアクセスできません。定数Latin-1文字列を効率的に指定する方法として、QtはQLatin1StringViewを提供しています。これはconst char * を包む非常に薄いラッパーに過ぎません。QLatin1StringViewを使用すると、上記のサンプルコードは次のようになります。

// Required for using the '_L1' string literal.
using namespace Qt::StringLiterals;
// ...
if (str == "auto"_L1
        || str == "extern"_L1
        || str == "static"_L1
        || str == "register"_L1) {
    //...
}

入力するコードは少し長くなりますが、最初のバージョンのコードとまったく同じ利点があり、QString::fromLatin1() を使用して Latin-1 文字列を変換するよりも高速です。

QString(QLatin1StringView) コンストラクタのおかげで、QLatin1StringView は、QString が期待されるあらゆる場所で使用できます。例えば:

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

注: QLatin1StringView引数で呼び出す関数が、実際にはQLatin1StringViewを受け取るようにオーバーロードされていない場合 、QString への暗黙の変換によってメモリの割り当てが発生します。これは通常、QLatin1StringViewを使用する本来の目的である「メモリ割り当てを回避する」という意図に反するため、そのような場合はQStringLiteral を使用する方が適切かもしれません。

注: Qtの要件により、ソースコードファイルがUTF-8でエンコードされている場合、QLatin1StringViewではUS-ASCIIリテラルしか 使用できません。QLatin1StringView("é") のようなUS-ASCII以外のリテラルは正しく表現されません。代わりに、8進数表記または16進数表記を使用できます。それぞれ、QLatin1StringView("\351") またはQLatin1StringView("\xe9") です。

QString 、QLatin1Char 、QStringLiteral 、およびQT_NO_CAST_FROM_ASCIIも参照してください 。

メンバ型のドキュメント

[alias] QLatin1StringView::const_iterator

iterator およびconst_reverse_iteratorも参照してください 。

[alias, since 6.7] QLatin1StringView::const_pointer

[alias, since 6.7] QLatin1StringView::pointer

value_type * の別名です。STL との互換性を確保するために提供されています。

これらの typedef は Qt 6.7 で導入されました。

[alias] QLatin1StringView::const_reference

reference の別名です。STL との互換性を確保するために提供されています。

[alias] QLatin1StringView::const_reverse_iterator

reverse_iterator およびconst_iteratorも参照してください 。

[alias] QLatin1StringView::difference_type

qsizetype の別名です。STL との互換性を確保するために提供されています。

[alias] QLatin1StringView::iterator

QLatin1StringView 可変イテレータをサポートしていないため、これはconst_iterator と同じです。

const_iterator およびreverse_iteratorも参照してください 。

[alias] QLatin1StringView::reference

value_type & の別名です。STL との互換性を確保するために提供されています。

[alias] QLatin1StringView::reverse_iterator

QLatin1StringView 可変のリバースイテレータをサポートしていないため、これはconst_reverse_iterator と同じです。

const_reverse_iterator およびiteratorも参照してください 。

[alias] QLatin1StringView::size_type

qsizetype の別名です。STL との互換性を確保するために提供されています。

注: Qt 6以前のバージョンでは 、これはint のエイリアスであり、64ビットアーキテクチャにおいてQLatin1StringView に格納できるデータ量を制限していました。

[alias] QLatin1StringView::value_type

const char の別名です。STL との互換性を確保するために提供されています。

メンバ関数のドキュメント

[constexpr noexcept] QLatin1StringView::QLatin1StringView()

nullptr を格納する QLatin1StringView オブジェクトを作成します。

data()、isEmpty()、isNull()、およびDistinction Between Null and Empty Stringsも参照してください 。

[explicit constexpr noexcept, since 6.3] QLatin1StringView::QLatin1StringView(QByteArrayView str)

str 上のビューとして QLatin1StringView オブジェクトを構築します。

文字列データはコピーされません。呼び出し側は、QLatin1StringView オブジェクトが存在する限り、str が指しているデータが削除または変更されないことを保証する必要があります。サイズは、ヌル終端の有無を確認することなく、str からそのまま取得されます。

注: バイト配列内のヌルバイト('\0')は、 この文字列に含まれます。この文字列がQString によって使用される場合、それらは Unicode ヌル文字(U+0000)に変換されます。

この関数は Qt 6.3 で導入されました。

latin1()も参照してください 。

[explicit noexcept] QLatin1StringView::QLatin1StringView(const QByteArray &str)

str 上のビューとして QLatin1StringView オブジェクトを構築します。

文字列データはコピーされません。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できる必要があります。

latin1()も参照してください 。

[explicit constexpr noexcept] QLatin1StringView::QLatin1StringView(const char *str)

str を格納する QLatin1StringView オブジェクトを生成します。

文字列データはコピーされません。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できる必要があります。

latin1()も参照してください 。

[constexpr noexcept, since 6.4] QLatin1StringView::QLatin1StringView(std::nullptr_t)

nullptr を格納するQLatin1StringViewオブジェクトを生成します。

この関数は Qt 6.4 で導入されました。

data()、isEmpty()、isNull()、およびDistinction Between Null and Empty Stringsも参照してください 。

[constexpr] QLatin1StringView::QLatin1StringView(const char *first, const char *last)

first を格納し、長さが (last -first) である QLatin1StringView オブジェクトを生成します。

[first,last) の範囲は、このLatin-1文字列オブジェクトの存続期間中、有効なままである必要があります。

last もnullptr である場合、first としてnullptr を渡すことは安全であり、その結果、Latin-1 文字列は null になります。

last がfirst より先にある場合、first がnullptr であるのに対しlast がそうでない場合、またはlast - first > INT_MAX である場合、挙動は未定義となります。

[constexpr noexcept] QLatin1StringView::QLatin1StringView(const char *str, qsizetype size)

`str ` を `size` で格納する `QLatin1StringView` オブジェクトを生成します。

文字列データはコピーされません。呼び出し元は、QLatin1StringView オブジェクトが存在する限り、str が削除または変更されないことを保証できなければなりません。

注: バイト配列内のヌルバイト('\0')は、 この文字列に含まれます。 この文字列が `QString` によって使用される場合、それらは Unicode ヌル文字 (U+0000) に変換されます。この動作は Qt 5.x とは異なります。

latin1()も参照してください 。

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

この文字列中の「%N 」を、「args 」からの対応する引数に置き換えます。引数は位置依存ではありません。args の最初の引数は、%N を最も低いN (すべて)に置き換え、args の2番目の引数は、%N を次に低いN に置き換える、というように続きます。

Args QAnyStringView へ暗黙的に変換可能なものであれば、どのようなものでも構成可能です。

注: Qt 6.9 以前のバージョンでは 、QAnyStringView および UTF-8 文字列(QUtf8StringView 、QByteArray 、QByteArrayView 、const char8_t* など)は、args としてサポートされていませんでした。

QString::arg()も参照してください 。

[constexpr] QLatin1Char QLatin1StringView::at(qsizetype pos) const

このオブジェクトのpos の位置にある文字を返します。

注:この関数はエラーチェック を行いません。pos < 0 またはpos >=size(である場合、動作は未定義です)。

operator[]()も参照してください 。

[constexpr] QLatin1Char QLatin1StringView::back() const

文字列の最後の文字を返します。at(size() - 1) と同じです。

この関数は、STLとの互換性を確保するために提供されています。

警告: 空の文字列に対してこの関数を呼び出すと 、未定義の挙動となります。

関連項目: front()、at()、およびoperator[]()。

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::begin() const

文字列の先頭文字を指す、STL スタイルのconstイテレータを返します。

この関数は、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)

この文字列をlength 文字分切り捨てます。

*this = left(size() - length) と同じです。

注: length < 0 またはlength >size() の場合、動作は 未定義です。

関連項目: sliced()、first()、last()、chopped()、truncate()、およびslice()。

[constexpr] QLatin1StringView QLatin1StringView::chopped(qsizetype length) const

このオブジェクトの先頭から、size() -length の長さの部分文字列を返します。

left(size() - length) と同じです。

注: length < 0 またはlength >size() の場合、動作は 未定義です。

関連項目: sliced()、first()、last()、chop()、truncate()、およびslice()。

[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

この文字列ビューを、それぞれUTF-16文字列ビューstr 、Latin-1文字列ビューl1 、または文字ch と比較します。この文字列がstr 、l1 、またはch より小さい場合は負の整数を返し、str 、l1 、またはch より大きい場合は正の整数を返し、等しい場合は0を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

operator==()、operator<()、およびoperator>()も参照してください 。

[noexcept, since 6.5] int QLatin1StringView::compare(QUtf8StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const

この文字列ビューとstr を比較し、この文字列ビューがstr より小さい場合は負の整数を、str より大きい場合は正の整数を、等しい場合は0を返します。

cs がQt::CaseSensitive (デフォルト)の場合、比較は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

この関数は Qt 6.5 で導入されました。

operator==()、operator<()、およびoperator>()も参照してください 。

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constBegin() const

begin() と同じです。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

この関数は Qt 6.4 で導入されました。

constEnd()、begin()、cbegin()、およびdata()も参照してください 。

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constData() const

このオブジェクトが参照するLatin-1文字列の先頭を返します。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

この関数は Qt 6.4 で導入されました。

data()も参照してください 。

[constexpr noexcept, since 6.4] const char *QLatin1StringView::constEnd() const

end() と同じです。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

この関数は Qt 6.4 で導入されました。

constBegin()、end()、cend()、およびcrend()も参照してください 。

[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

この Latin-1 文字列ビューに、str で指定された UTF-16 文字列、l1 で指定された Latin-1 文字列、または文字ch がそれぞれ含まれている場合は、true を返します。それ以外の場合は、false を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

indexOf()、QStringView::contains()、QStringView::indexOf()、およびQString::indexOf()も参照してください 。

[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

この文字列ビューにおいて、str で表される UTF-16 文字列、l1 で表される Latin-1 文字列、またはch で表される文字の(重複する可能性のある)出現回数をそれぞれ返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

これらの関数は Qt 6.4 で導入されました。

contains() およびindexOf()も参照してください 。

[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

このオブジェクトが参照する Latin-1 文字列の先頭を返します。

[constexpr noexcept, since 6.4] bool QLatin1StringView::empty() const

このオブジェクトが参照するLatin-1文字列が空(size() == 0 )であるかどうかを返します。

この関数は、STLとの互換性を確保するために提供されています。

この関数は Qt 6.4 で導入されました。

isEmpty()、isNull()、およびsize()も参照してください 。

[constexpr noexcept] QLatin1StringView::const_iterator QLatin1StringView::end() const

文字列の最後の文字の直後を指す、STL スタイルのconstイテレータを返します。

この関数は、STLとの互換性を確保するために提供されています。

begin()、cend()、およびrend()も参照してください 。

[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

この Latin-1 文字列ビューが、それぞれ UTF-16 文字列 `str`、`l1` で表示される Latin-1 文字列、または文字 `ch` で終わる場合、true を返します。それ以外の場合は、false を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

startsWith()も参照してください 。

[constexpr, since 6.4] QLatin1Char QLatin1StringView::first() const

文字列の先頭文字を返します。at(0) またはfront() と同じ動作をします。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

警告: 空の文字列に対してこの関数を呼び出すと 、未定義の挙動となります。

この関数は Qt 6.4 で導入されました。

last()、front()、およびback()も参照してください 。

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::first(qsizetype n) const

この文字列ビューの先頭からn 文字を含むLatin-1文字列ビューを返します。

注: n < 0 またはn >size() の場合、動作は 未定義です。

この関数は Qt 6.0 で導入されました。

関連項目: last()、startsWith()、chopped()、chop()、truncate()、およびslice()。

[constexpr] QLatin1Char QLatin1StringView::front() const

文字列の先頭文字を返します。at(0) と同じ動作です。

この関数は、STLとの互換性を確保するために提供されています。

警告: 空の文字列に対してこの関数を呼び出すと 、未定義の挙動となります。

関連項目: back()、at()、およびoperator[]()。

[noexcept] qsizetype QLatin1StringView::indexOf(QChar c, qsizetype from = 0) const

[noexcept] qsizetype QLatin1StringView::indexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) 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

インデックス位置from から前方へ検索し、str で参照される UTF-16 文字列、l1 で参照される Latin-1 文字列、またはch で参照される文字が、この Latin-1 文字列ビュー内で最初に現れる位置のインデックスを返します。str 、l1 、またはc がそれぞれ見つからない場合は -1 を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

from が -1 の場合、検索は最後の文字から開始されます。-2 の場合は、最後から 2 番目の文字から開始されます。

QString::indexOf()も参照してください 。

[constexpr noexcept] bool QLatin1StringView::isEmpty() const

このオブジェクトが参照する Latin-1 文字列が空(size() == 0 )であるかどうかを返します。

isNull() およびsize()も参照してください 。

[constexpr noexcept] bool QLatin1StringView::isNull() const

このオブジェクトが参照する Latin-1 文字列が null (data() == nullptr) であるかどうかを返します。

isEmpty() およびdata()も参照してください 。

[constexpr, since 6.4] QLatin1Char QLatin1StringView::last() const

文字列の最後の文字を返します。at(size() - 1) またはback() と同じ動作をします。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

警告: 空の文字列に対してこの関数を呼び出すと 、未定義の挙動となります。

この関数は Qt 6.4 で導入されました。

first()、back()、およびfront()も参照してください 。

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::last(qsizetype n) const

この文字列ビューの最後のn 文字を含む Latin-1 文字列ビューを返します。

注: n < 0 またはn >size() の場合、動作は 未定義です。

この関数は Qt 6.0 で導入されました。

関連項目: first()、endsWith()、chopped()、chop()、truncate()、およびslice()。

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QChar c) const

[noexcept, since 6.3] qsizetype QLatin1StringView::lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QChar c, qsizetype from) const

[noexcept] qsizetype QLatin1StringView::lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) 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

インデックス位置from から逆方向に検索し、str で指定された UTF-16 文字列、l1 で指定された Latin-1 文字列、またはch で指定された文字が、この Latin-1 文字列ビュー内で最後に現れる位置のインデックスを返します。str 、l1 、またはch がそれぞれ見つからない場合は -1 を返します。

from が-1の場合、検索は最後の文字から開始されます。-2の場合は最後から2番目の文字から開始され、以下同様です。

cs がQt::CaseSensitive (デフォルト) の場合、検索は大文字と小文字を区別します。それ以外の場合、検索は大文字と小文字を区別しません。

注: 長さ 0 の `str ` または `l1` を検索する場合 、通常 `-1 ` は文字列の末尾から検索すると考えられていますが、負の `from` を指定すると、データの末尾にある一致は検索から除外されます。末尾の一致は最後の文字の後に位置するため、除外されるのです。 このような末尾の空の一致を含めるには、from に正の値を指定するか、from パラメータを完全に省略してください。

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

str で参照される UTF-16 文字列、あるいはl1 で参照される Latin-1 文字列が、この Latin-1 文字列ビュー内で最後に現れる位置のインデックスを返します。str またはl1 がそれぞれ見つからない場合は、-1 を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

これらの関数は Qt 6.2 で導入されました。

[constexpr noexcept] const char *QLatin1StringView::latin1() const

このオブジェクトが参照する Latin-1 文字列の先頭を返します。

[constexpr] QLatin1StringView QLatin1StringView::left(qsizetype length) const

length が範囲外になる可能性がないことが分かっている場合は、新しいコードでは代わりにfirst() を使用してください。こちらの方が処理が高速だからです。

この Latin-1 文字列ビューにおいて、位置 0 から始まる長さlength の部分文字列を返します。

length がsize() 以上、または 0 未満の場合、Latin-1 文字列ビュー全体が返されます。

first()、last()、sliced()、startsWith()、chopped()、chop()、truncate()、およびslice()も参照してください 。

[constexpr noexcept, since 6.4] qsizetype QLatin1StringView::length() const

size() と同じです。

この関数は、他の Qt コンテナとの互換性を確保するために提供されています。

この関数は Qt 6.4 で導入されました。

[static constexpr noexcept, since 6.8] qsizetype QLatin1StringView::maxSize()

文字列ビューが理論上表現できる要素の最大数を返します。実際には、システムで利用可能なメモリ量によって制限されるため、この数ははるかに小さくなる場合があります。

この関数は 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

この Latin-1 文字列ビューにおいて、位置start から始まる長さlength の部分文字列を返します。

start およびlength が範囲外になることがないことが分かっている場合は、新しいコードではsliced() を使用してください。処理が高速になります。

start がこの文字列ビューの長さを超える場合、空のLatin-1文字列ビューを返します。start から始まるこの文字列ビューで利用可能な文字数がlength 文字未満である場合、またはlength が負の値(デフォルト)である場合、この関数はstart から利用可能なすべての文字を返します。

関連項目: first(),last(),sliced(),chopped(),chop(),truncate(),slice()。

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::rbegin() const

文字列の最初の文字を逆順に指す、STL スタイルのconst リバースイテレータを返します。

この関数は、STLとの互換性を確保するために提供されています。

rend()、crbegin()、およびbegin()も参照してください 。

[noexcept] QLatin1StringView::const_reverse_iterator QLatin1StringView::rend() const

文字列の最後の文字の直後を指す、STL スタイルの逆方向イテレータを、逆順で返します。

この関数は、STLとの互換性を確保するために提供されています。

rbegin()、crend()、およびend()も参照してください 。

length が範囲外になる可能性がないことが分かっている場合は、新しいコードでは代わりにlast() を使用してください。こちらの方が処理が高速だからです。

この Latin-1 文字列ビューにおいて、位置size() -length から始まる、長さlength の部分文字列を返します。

length がsize() 以上、または 0 未満の場合、Latin-1 文字列ビュー全体が返されます。

first()、last()、sliced()、endsWith()、chopped()、chop()、truncate()、およびslice()も参照してください 。

[constexpr noexcept] qsizetype QLatin1StringView::size() const

このオブジェクトが参照する Latin-1 文字列のサイズを返します。

注: Qt 6 以前のバージョンでは 、この関数は `int` を返しており、64 ビットアーキテクチャにおいて `QLatin1StringView ` に格納できるデータ量が制限されていました。

[constexpr, since 6.8] QLatin1StringView &QLatin1StringView::slice(qsizetype pos)

この Latin-1 文字列ビューを、位置pos から始まり、その終わりまで続くように変更します。

注: pos < 0 またはpos >size() の場合、動作は 未定義です。

この関数は Qt 6.8 で導入されました。

関連項目: sliced()、first()、last()、chopped()、chop()、およびtruncate()。

[constexpr, since 6.8] QLatin1StringView &QLatin1StringView::slice(qsizetype pos, qsizetype n)

この Latin-1 文字列ビューを、位置pos から始まり、n 文字分延長されるように変更します。

注: pos < 0、n < 0、またはpos + n > size() の場合、動作は 未定義です。

これはオーバーロードされた関数です。

この関数は Qt 6.8 で導入されました。

関連項目: sliced()、first()、last()、chopped()、chop()、およびtruncate()。

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::sliced(qsizetype pos) const

この文字列ビューのpos の位置から始まり、その終わりまで続くLatin-1文字列ビューを返します。

注: pos < 0 またはpos >size() の場合、動作は 未定義です。

この関数は Qt 6.0 で導入されました。

関連項目: first()、last()、chopped()、chop()、truncate()、およびslice()。

[constexpr, since 6.0] QLatin1StringView QLatin1StringView::sliced(qsizetype pos, qsizetype n) const

この文字列ビューの位置pos から始まる、n 文字分の領域を指す Latin-1 文字列ビューを返します。

注: pos < 0、n < 0、またはpos + n > size() の場合、動作は 未定義です。

この関数は Qt 6.0 で導入されました。

関連項目: first()、last()、chopped()、chop()、truncate()、およびslice()。

[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

この Latin-1 文字列ビューの先頭が、それぞれ `str` で表示される UTF-16 文字列、`l1` で表示される Latin-1 文字列、あるいは文字 `ch` で始まる場合、true を返します。それ以外の場合は、false を返します。

cs がQt::CaseSensitive (デフォルト)の場合、検索は大文字と小文字を区別します。それ以外の場合は、大文字と小文字を区別しません。

endsWith()も参照してください 。

[since 6.4] double QLatin1StringView::toDouble(bool *ok = nullptr) const

[since 6.4] float QLatin1StringView::toFloat(bool *ok = nullptr) const

このQLatin1StringView を、対応する浮動小数点値に変換して返します。

変換時にオーバーフローが発生した場合は無限大を、その他の理由(アンダーフローなど)で変換に失敗した場合は0.0を返します。

ok がnullptr でない場合、*ok をfalse に設定して失敗を報告し、*ok をtrue に設定して成功を報告します。

警告: ` QLatin1StringView ` の内容には 、プラス/マイナス記号、科学表記で使用される文字「e」、および小数点を含む、有効な数値文字のみを含めることができます。単位やその他の文字を含めると、変換エラーが発生します。

注: 数値の変換は 、ユーザーのロケールに関係なく、デフォルトの C ロケールで行われます。数値と文字列間のロケールに応じた変換を行うには、QLocale を使用してください。

この関数は、先頭および末尾の空白文字を無視します。

これらの関数は Qt 6.4 で導入されました。

[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

このQLatin1StringView を、基数base (デフォルトは10)を用いて対応する数値に変換したものを返します。基数0および2から36までがサポートされており、9を超える桁にはアルファベットが使用されます。Aは10、Bは11というように続きます。

base が 0 の場合、Latin-1 文字列ビューが次のように始まる場合、以下のルール(この順序で)に従って基数が自動的に決定されます:

  • "0x"、残りの部分は16進数(基数16)として読み込まれます
  • "0b"、残りの部分は2進数(基数2)として読み取られます
  • "0"、残りの部分は8進数(基数8)として読み取られます
  • それ以外の場合は10進数として読み取られます

変換に失敗した場合は 0 を返します。

ok がnullptr でない場合、失敗は *ok をfalse に設定することで報告され、成功は *ok をtrue に設定することで報告されます。

注: 数値の変換は 、ユーザーのロケールに関係なく、デフォルトの C ロケールで行われます。数値と文字列間のロケールに応じた変換を行うには、QLocale を使用してください。

この関数は、先頭および末尾の空白文字を無視します。

注: 「0b」接頭辞のサポートは Qt 6.4 で追加されました。

これらの関数は Qt 6.4 で導入されました。

[since 6.0] QString QLatin1StringView::toString() const

このLatin-1文字列をQString に変換します。以下と同等です。

return QString(*this);

この関数はQt 6.0で導入されました。

toUtf8()も参照してください 。

[since 6.9] QByteArray QLatin1StringView::toUtf8() const

文字列のUTF-8表現をQByteArray として返します。この関数は、まずQString に変換するよりも効率的です。

この関数は Qt 6.9 で導入されました。

toString() およびQString::toUtf8()も参照してください 。

[constexpr noexcept(...), since 6.0] template <typename Needle, typename... Flags> auto QLatin1StringView::tokenize(Needle &&sep, Flags... flags) const

sep が出現する箇所ごとに文字列を部分文字列ビューに分割し、それらの文字列からなる遅延シーケンスを返します。

以下と同等ですが、

return QStringTokenizer{std::forward<Needle>(sep), flags...};

に相当しますが、コンパイラで C++17 のクラステンプレート引数推論 (CTAD) が有効になっていなくても動作します。

結果を形成するために、sep とflags がどのように相互作用するかについては、QStringTokenizer を参照してください。

注: この関数はQStringTokenizerを返しますが 、そのテンプレート引数を明示的に指定してはいけません。C++17 のクラステンプレート引数推論 (CTAD) を使用できる場合は、

QStringTokenizer result = sv.tokenize(sep);

(テンプレート引数なし)のように記述できます。C++17のCTADが使用できない場合は、戻り値をauto 型の変数にのみ格納する必要があります:

auto result = sv.tokenize(sep);

これは、QStringTokenizer のテンプレート引数が、それが返される特定のtokenize()のオーバーロードに対して非常に微妙な依存関係を持っており、通常、区切り文字に使用される型とは一致しないためです。

これらの関数は Qt 6.0 で導入されました。

注: noexcept(qTokenize(std::declval<const QLatin1StringView &>(), std::forward<Needle>(needle), flags...)) がtrue の場合、この関数は noexcept です。

「 QStringTokenizer 」および「qTokenize()」も参照してください 。

[noexcept] QLatin1StringView QLatin1StringView::trimmed() const

先頭と末尾の空白文字を取り除き、その結果を返します。

空白とは、QChar::isSpace() の戻り値がtrue となる任意の文字を指します。これには、ASCII 文字の '\t'、'\n'、'\v'、'\f'、'\r'、および ' ' が含まれます。

[constexpr] void QLatin1StringView::truncate(qsizetype length)

この文字列を長さlength に切り詰めます。

*this = left(length) と同じです。

注: length < 0 またはlength >size() の場合、動作は 未定義です。

sliced()、first()、last()、chopped()、およびchop()も参照してください 。

[constexpr] QLatin1Char QLatin1StringView::operator[](qsizetype pos) const

このオブジェクトのpos の位置にある文字を返します。

注:この関数はエラーチェック を行いません。pos < 0 またはpos >=size() の場合、動作は未定義です。

at()も参照してください 。

関連する非メンバー関数

[noexcept] bool operator!=(const QChar &lhs, const QLatin1StringView &rhs)

char `lhs ` が文字列 `rhs` と字句的に等しくない場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` と字句的に等しくない場合、`true ` を返します。それ以外の場合は `false` を返します。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` とレキシカルに等しくない場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が、文字列ビュー `rhs` と字句的に等しくない場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` と等しくない場合、true を返します。それ以外の場合は、false を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーから見えるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator!=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が、文字列 `rhs` と字句的に等しくない場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator!=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が、文字列 `rhs` とレキシカルに等しくない場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator!=(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs バイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列を `QObject::tr()` を通じて処理させたい場合などに役立ちます。

この関数は、QLatin1StringView::operator!=() をオーバーロードしています。

[constexpr noexcept, since 6.4] QLatin1StringView operator""_L1(const char *str, size_t size)

文字リテラル `str` の先頭size 文字から、QLatin1StringView を作成するリテラル演算子です。

次のコードは、QLatin1StringView を作成します:

using namespace Qt::StringLiterals;

auto str = "hello"_L1;

この関数は Qt 6.4 で導入されました。

「Qt::Literals::StringLiterals」も参照してください 。

[noexcept] bool operator<(const QChar &lhs, const QLatin1StringView &rhs)

char型lhs が文字列rhs よりも字句的に小さい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` より字句的に小さい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` より辞書順で小さい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が文字列ビュー `rhs` より辞書的に小さい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` よりも字句的に小さい場合、true を返します。そうでない場合は、false を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator<(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が文字列 `rhs` より辞書的に小さい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator<(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が文字列 `rhs` よりも字句的に小さい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs のバイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

これはオーバーロードされた関数です。

[noexcept] bool operator<=(const QChar &lhs, const QLatin1StringView &rhs)

char型lhs が文字列rhs よりも辞書順で小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` よりも辞書順で小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` よりも辞書順で小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が文字列 `rhs` よりも辞書的に小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` よりも字句的に小さいか等しい場合、`true ` を返します。それ以外の場合は `false` を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーから見えるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator<=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が文字列 `rhs` よりも辞書的に小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が文字列 `rhs` よりも辞書順で小さいか等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator<=(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs のバイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

これはオーバーロードされた関数です。

[noexcept] bool operator==(const QChar &lhs, const QLatin1StringView &rhs)

char型lhs が文字列rhs と字句的に等しい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` と字句的に等しい場合は `true ` を返し、そうでない場合は `false` を返します。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` と字句的に等しい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が文字列ビュー `rhs` と字句的に等しい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator==(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` と等しい場合は `true ` を返し、そうでない場合は `false` を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーから見えるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator==(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が文字列 `rhs` と字句的に等しい場合は `true ` を返し、そうでない場合は `false` を返します。

[noexcept] bool operator==(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が文字列 `rhs` とレキシカルに等しい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator==(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs のバイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

これはオーバーロードされた関数です。

[noexcept] bool operator>(const QChar &lhs, const QLatin1StringView &rhs)

charlhs が stringrhs より字句的に大きい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` より辞書順で大きい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` より字句的に大きい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が文字列ビュー `rhs` より辞書的に大きい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator>(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` より字句的に大きい場合、true を返します。それ以外の場合は、false を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーから見えるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator>(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が文字列 `rhs` より辞書的に大きい場合は `true ` を返し、そうでない場合は `false` を返します。

[noexcept] bool operator>(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が文字列 `rhs` よりも辞書順で大きい場合、true を返します。そうでない場合は、false を返します。

[noexcept] bool operator>(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs のバイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

これはオーバーロードされた関数です。

[noexcept] bool operator>=(const QChar &lhs, const QLatin1StringView &rhs)

char型lhs が文字列rhs よりも辞書順で大きい(または等しい)場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QChar &rhs)

文字列 `lhs ` が文字 `rhs` よりも辞書順で大きい、または等しい場合は `true ` を返し、そうでない場合は `false` を返します。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QLatin1StringView &rhs)

文字列 `lhs ` が文字列 `rhs` よりも辞書順で大きい、または等しい場合は `true ` を返し、そうでない場合は `false` を返します。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QStringView &rhs)

文字列 `lhs ` が文字列 `rhs` よりも辞書順で大きい、または等しい場合は `true ` を返します。それ以外の場合は `false` を返します。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const char *const &rhs)

文字列 `lhs ` が `const char` ポインタ `rhs` よりも辞書順で大きい、または等しい場合は `true ` を返し、そうでない場合は `false` を返します。

rhs の const char ポインタは、QUtf8StringView に変換されます。

アプリケーションをコンパイルする際に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーから見えるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

「Comparing Strings」も参照してください 。

[noexcept] bool operator>=(const QStringView &lhs, const QLatin1StringView &rhs)

文字列ビュー `lhs ` が文字列 `rhs` より辞書的に大きい、または等しい場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator>=(const char *const &lhs, const QLatin1StringView &rhs)

const char ポインタ `lhs ` が文字列 `rhs` よりも辞書順で大きい(または等しい)場合、true を返します。それ以外の場合は、false を返します。

[noexcept] bool operator>=(const QLatin1StringView &lhs, const QByteArray &rhs)

rhs のバイト配列は、QUtf8StringView に変換されます。

アプリケーションのコンパイル時に `QT_NO_CAST_FROM_ASCII ` を定義することで、この演算子を無効にすることができます。これは、例えば、ユーザーに表示されるすべての文字列が `QObject::tr()` を経由するようにしたい場合などに役立ちます。

これはオーバーロードされた関数です。

© 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.