Struct qt_core::QString

source ·
#[repr(C)]
pub struct QString { /* private fields */ }
Expand description

The QString class provides a Unicode character string.

C++ class: QString.

C++ documentation:

The QString class provides a Unicode character string.

QString stores a string of 16-bit QChars, where each QChar corresponds one Unicode 4.0 character. (Unicode characters with code values above 65535 are stored using surrogate pairs, i.e., two consecutive QChars.)

Unicode is an international standard that supports most of the writing systems in use today. It is a superset of US-ASCII (ANSI X3.4-1986) and Latin-1 (ISO 8859-1), and all the US-ASCII/Latin-1 characters are available at the same code positions.

Behind the scenes, QString uses implicit sharing (copy-on-write) to reduce memory usage and to avoid the needless copying of data. This also helps reduce the inherent overhead of storing 16-bit characters instead of 8-bit characters.

In addition to QString, Qt also provides the QByteArray class to store raw bytes and traditional 8-bit '\0'-terminated strings. For most purposes, QString is the class you want to use. It is used throughout the Qt API, and the Unicode support ensures that your applications will be easy to translate if you want to expand your application's market at some point. The two main cases where QByteArray is appropriate are when you need to store raw binary data, and when memory conservation is critical (like in embedded systems).

Implementations§

source§

impl QString

source

pub fn from_std_str<S: AsRef<str>>(s: S) -> CppBox<QString>

Creates Qt string from an std string.

QString makes a deep copy of the data.

source

pub fn to_std_string(&self) -> String

Creates an std string from a Qt string.

source§

impl QString

source

pub unsafe fn add_assign_q_char( &self, c: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(QChar c).

C++ documentation:

This function overloads operator+=().

Appends the character ch to the string.

source

pub unsafe fn add_assign_special_character( &self, c: SpecialCharacter ) -> Ref<QString>

Calls C++ function: QString& QString::operator+=(QChar::SpecialCharacter c).

source

pub unsafe fn add_assign_q_string( &self, s: impl CastInto<Ref<QString>> ) -> Ref<QString>

Appends the string other onto the end of this string and returns a reference to this string.

Calls C++ function: QString& QString::operator+=(const QString& s).

C++ documentation:

Appends the string other onto the end of this string and returns a reference to this string.

Example:

QString x = “free”; QString y = “dom”; x += y; // x == “freedom”

This operation is typically very fast (constant time), because QString preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.

See also append() and prepend().

source

pub unsafe fn add_assign_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(const QStringRef& s).

C++ documentation:

This function overloads operator+=().

Appends the string section referenced by str to this string.

source

pub unsafe fn add_assign_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(QLatin1String s).

C++ documentation:

This function overloads operator+=().

Appends the Latin-1 string str to this string.

source

pub unsafe fn add_assign_char(&self, s: *const c_char) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(const char* s).

C++ documentation:

This function overloads operator+=().

Appends the string str to this string. The const char pointer is converted to Unicode using the fromUtf8() function.

You can disable this function by defining 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.

source

pub unsafe fn add_assign_q_byte_array( &self, s: impl CastInto<Ref<QByteArray>> ) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(const QByteArray& s).

C++ documentation:

This function overloads operator+=().

Appends the byte array ba to this string. The byte array is converted to Unicode using the fromUtf8() function. If any NUL characters ('\0') are embedded in the ba byte array, they will be included in the transformation.

You can disable this function by defining 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.

source

pub unsafe fn add_assign_char2(&self, c: c_char) -> Ref<QString>

This function overloads operator+=().

Calls C++ function: QString& QString::operator+=(char c).

C++ documentation:

This function overloads operator+=().

Appends the character ch to this string. Note that the character is converted to Unicode using the fromLatin1() function, unlike other 8-bit functions that operate on UTF-8 data.

You can disable this function by defining 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.

source

pub unsafe fn append_q_char(&self, c: impl CastInto<Ref<QChar>>) -> Ref<QString>

This function overloads append().

Calls C++ function: QString& QString::append(QChar c).

C++ documentation:

This function overloads append().

Appends the character ch to this string.

source

pub unsafe fn append_q_char_int( &self, uc: impl CastInto<Ptr<QChar>>, len: c_int ) -> Ref<QString>

This function overloads append().

Calls C++ function: QString& QString::append(const QChar* uc, int len).

C++ documentation:

This function overloads append().

Appends len characters from the QChar array str to this string.

This function was introduced in Qt 5.0.

source

pub unsafe fn append_q_string( &self, s: impl CastInto<Ref<QString>> ) -> Ref<QString>

Appends the string str onto the end of this string.

Calls C++ function: QString& QString::append(const QString& s).

C++ documentation:

Appends the string str onto the end of this string.

Example:

QString x = “free”; QString y = “dom”;

x.append(y); // x == “freedom”

This is the same as using the insert() function:

x.insert(x.size(), y);

The append() function is typically very fast (constant time), because QString preallocates extra space at the end of the string data so it can grow without reallocating the entire string each time.

See also operator+=(), prepend(), and insert().

source

pub unsafe fn append_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> Ref<QString>

Appends the given string reference to this string and returns the result.

Calls C++ function: QString& QString::append(const QStringRef& s).

C++ documentation:

Appends the given string reference to this string and returns the result.

This function was introduced in Qt 4.4.

source

pub unsafe fn append_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads append().

Calls C++ function: QString& QString::append(QLatin1String s).

C++ documentation:

This function overloads append().

Appends the Latin-1 string str to this string.

source

pub unsafe fn append_char(&self, s: *const c_char) -> Ref<QString>

This function overloads append().

Calls C++ function: QString& QString::append(const char* s).

C++ documentation:

This function overloads append().

Appends the string str to this string. The given const char pointer is converted to Unicode using the fromUtf8() function.

You can disable this function by defining 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.

source

pub unsafe fn append_q_byte_array( &self, s: impl CastInto<Ref<QByteArray>> ) -> Ref<QString>

This function overloads append().

Calls C++ function: QString& QString::append(const QByteArray& s).

C++ documentation:

This function overloads append().

Appends the byte array ba to this string. The given byte array is converted to Unicode using the fromUtf8() function.

You can disable this function by defining 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.

source

pub unsafe fn arg_i64_2_int_q_char( &self, a: i64, fieldwidth: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qlonglong a, int fieldwidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_u64_2_int_q_char( &self, a: u64, fieldwidth: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qulonglong a, int fieldwidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_long2_int_q_char( &self, a: c_long, fieldwidth: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(long a, int fieldwidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The a argument is expressed in the given base, which is 10 by default and must be between 2 and 36.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using QLocale::setDefault(). The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ulong2_int_q_char( &self, a: c_ulong, fieldwidth: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned long a, int fieldwidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a to a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_3_int_q_char( &self, a: c_int, field_width: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(int a, int fieldWidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

The a argument is expressed in base base, which is 10 by default and must be between 2 and 36. For bases other than 10, a is treated as an unsigned integer.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used. The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_uint2_int_q_char( &self, a: c_uint, field_width: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned int a, int fieldWidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_short2_int_q_char( &self, a: c_short, field_width: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(short a, int fieldWidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ushort2_int_q_char( &self, a: c_ushort, field_width: c_int, base: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned short a, int fieldWidth = …, int base = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_double_int_char_int_q_char( &self, a: c_double, field_width: c_int, fmt: c_char, prec: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(double a, int fieldWidth = …, char fmt = …, int prec = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

Argument a is formatted according to the specified format and precision. See Argument Formats for details.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

double d = 12.34; QString str = QString(“delta: %1”).arg(d, 0, ‘E’, 3); // str == “delta: 1.234E+01”

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used.

If fillChar is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.

See also QLocale::toString().

source

pub unsafe fn arg_char_int_q_char( &self, a: c_char, field_width: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(char a, int fieldWidth = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

The a argument is interpreted as a Latin-1 character.

source

pub unsafe fn arg_q_char_int_q_char( &self, a: impl CastInto<Ref<QChar>>, field_width: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(QChar a, int fieldWidth = …, QChar fillChar = …) const.

C++ documentation:

This function overloads arg().

source

pub unsafe fn arg_q_string_int_q_char( &self, a: impl CastInto<Ref<QString>>, field_width: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, ..., %99.

Calls C++ function: QString QString::arg(const QString& a, int fieldWidth = …, QChar fillChar = …) const.

C++ documentation:

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, …, %99.

fieldWidth specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

QString i; // current file’s number QString total; // number of files to process QString fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest numbered unreplaced place marker, no matter where it appears. Also, if place marker %i appears more than once in the string, the arg() replaces all of them.

If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.

source

pub unsafe fn arg_2_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2) const.

C++ documentation:

This function overloads arg().

This is the same as str.arg(a1).arg(a2), except that the strings a1 and a2 are replaced in one pass. This can make a difference if a1 contains e.g. %1:

QString str; str = “%1 %2”;

str.arg(“%1f”, “Hello”); // returns “%1f Hello” str.arg(“%1f”).arg(“Hello”); // returns “Hellof %2”

A similar problem occurs when the numbered place markers are not white space separated:

QString str; str = “%1%3%2”; str.arg(“Hello”).arg(20).arg(50); // returns “Hello500”

str = “%1%2%3”; str.arg(“Hello”).arg(50).arg(20); // returns “Hello5020”

Let's look at the substitutions:

  • First, Hello replaces %1 so the string becomes "Hello%3%2".
  • Then, 20 replaces %2 so the string becomes "Hello%320".
  • Since the maximum numbered place marker value is 99, 50 replaces %32.

Thus the string finally becomes "Hello500".

In such cases, the following yields the expected results:

QString str; str = “%1%2%3”; str.arg(“Hello”, QString::number(20), QString::number(50)); // returns “Hello5020”

source

pub unsafe fn arg_3_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3), except that the strings a1, a2 and a3 are replaced in one pass.

source

pub unsafe fn arg_4_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4), except that the strings a1, a2, a3 and a4 are replaced in one pass.

source

pub unsafe fn arg_5_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>>, a5: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4, const QString& a5) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5), except that the strings a1, a2, a3, a4, and a5 are replaced in one pass.

source

pub unsafe fn arg_6_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>>, a5: impl CastInto<Ref<QString>>, a6: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4, const QString& a5, const QString& a6) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6)), except that the strings a1, a2, a3, a4, a5, and a6 are replaced in one pass.

source

pub unsafe fn arg_7_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>>, a5: impl CastInto<Ref<QString>>, a6: impl CastInto<Ref<QString>>, a7: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4, const QString& a5, const QString& a6, const QString& a7) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7), except that the strings a1, a2, a3, a4, a5, a6, and a7 are replaced in one pass.

source

pub unsafe fn arg_8_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>>, a5: impl CastInto<Ref<QString>>, a6: impl CastInto<Ref<QString>>, a7: impl CastInto<Ref<QString>>, a8: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4, const QString& a5, const QString& a6, const QString& a7, const QString& a8) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7).arg(a8), except that the strings a1, a2, a3, a4, a5, a6, a7, and a8 are replaced in one pass.

source

pub unsafe fn arg_9_q_string( &self, a1: impl CastInto<Ref<QString>>, a2: impl CastInto<Ref<QString>>, a3: impl CastInto<Ref<QString>>, a4: impl CastInto<Ref<QString>>, a5: impl CastInto<Ref<QString>>, a6: impl CastInto<Ref<QString>>, a7: impl CastInto<Ref<QString>>, a8: impl CastInto<Ref<QString>>, a9: impl CastInto<Ref<QString>> ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(const QString& a1, const QString& a2, const QString& a3, const QString& a4, const QString& a5, const QString& a6, const QString& a7, const QString& a8, const QString& a9) const.

C++ documentation:

This function overloads arg().

This is the same as calling str.arg(a1).arg(a2).arg(a3).arg(a4).arg(a5).arg(a6).arg(a7).arg(a8).arg(a9), except that the strings a1, a2, a3, a4, a5, a6, a7, a8, and a9 are replaced in one pass.

source

pub unsafe fn arg_i64_2_int( &self, a: i64, fieldwidth: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qlonglong a, int fieldwidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_i64_int(&self, a: i64, fieldwidth: c_int) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qlonglong a, int fieldwidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_i64(&self, a: i64) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qlonglong a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_u64_2_int( &self, a: u64, fieldwidth: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qulonglong a, int fieldwidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_u64_int(&self, a: u64, fieldwidth: c_int) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qulonglong a, int fieldwidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_u64(&self, a: u64) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(qulonglong a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_long2_int( &self, a: c_long, fieldwidth: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(long a, int fieldwidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The a argument is expressed in the given base, which is 10 by default and must be between 2 and 36.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using QLocale::setDefault(). The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_long_int( &self, a: c_long, fieldwidth: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(long a, int fieldwidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The a argument is expressed in the given base, which is 10 by default and must be between 2 and 36.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using QLocale::setDefault(). The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_long(&self, a: c_long) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(long a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The a argument is expressed in the given base, which is 10 by default and must be between 2 and 36.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale. The default locale is determined from the system's locale settings at application startup. It can be changed using QLocale::setDefault(). The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ulong2_int( &self, a: c_ulong, fieldwidth: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned long a, int fieldwidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a to a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ulong_int( &self, a: c_ulong, fieldwidth: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned long a, int fieldwidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a to a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ulong(&self, a: c_ulong) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned long a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a to a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_3_int( &self, a: c_int, field_width: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(int a, int fieldWidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

The a argument is expressed in base base, which is 10 by default and must be between 2 and 36. For bases other than 10, a is treated as an unsigned integer.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used. The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_2_int(&self, a: c_int, field_width: c_int) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(int a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

The a argument is expressed in base base, which is 10 by default and must be between 2 and 36. For bases other than 10, a is treated as an unsigned integer.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used. The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_int(&self, a: c_int) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(int a) const.

C++ documentation:

This function overloads arg().

The a argument is expressed in base base, which is 10 by default and must be between 2 and 36. For bases other than 10, a is treated as an unsigned integer.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used. The 'L' flag is ignored if base is not 10.

QString str; str = QString(“Decimal 63 is %1 in hexadecimal”) .arg(63, 0, 16); // str == “Decimal 63 is 3f in hexadecimal”

QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); str = QString(“%1 %L2 %L3”) .arg(12345) .arg(12345) .arg(12345, 0, 16); // str == “12345 12,345 3039”

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_uint2_int( &self, a: c_uint, field_width: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned int a, int fieldWidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_uint_int( &self, a: c_uint, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned int a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_uint(&self, a: c_uint) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned int a) const.

C++ documentation:

This function overloads arg().

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_short2_int( &self, a: c_short, field_width: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(short a, int fieldWidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_short_int( &self, a: c_short, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(short a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_short(&self, a: c_short) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(short a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ushort2_int( &self, a: c_ushort, field_width: c_int, base: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned short a, int fieldWidth = …, int base = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ushort_int( &self, a: c_ushort, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned short a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_ushort(&self, a: c_ushort) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(unsigned short a) const.

C++ documentation:

This function overloads arg().

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

The base argument specifies the base to use when converting the integer a into a string. The base must be between 2 and 36, with 8 giving octal, 10 decimal, and 16 hexadecimal numbers.

If fillChar is '0' (the number 0, ASCII 48), the locale's zero is used. For negative numbers, zero padding might appear before the minus sign.

source

pub unsafe fn arg_double_int_char_int( &self, a: c_double, field_width: c_int, fmt: c_char, prec: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(double a, int fieldWidth = …, char fmt = …, int prec = …) const.

C++ documentation:

This function overloads arg().

Argument a is formatted according to the specified format and precision. See Argument Formats for details.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

double d = 12.34; QString str = QString(“delta: %1”).arg(d, 0, ‘E’, 3); // str == “delta: 1.234E+01”

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used.

If fillChar is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.

See also QLocale::toString().

source

pub unsafe fn arg_double_int_char( &self, a: c_double, field_width: c_int, fmt: c_char ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(double a, int fieldWidth = …, char fmt = …) const.

C++ documentation:

This function overloads arg().

Argument a is formatted according to the specified format and precision. See Argument Formats for details.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

double d = 12.34; QString str = QString(“delta: %1”).arg(d, 0, ‘E’, 3); // str == “delta: 1.234E+01”

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used.

If fillChar is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.

See also QLocale::toString().

source

pub unsafe fn arg_double_int( &self, a: c_double, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(double a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

Argument a is formatted according to the specified format and precision. See Argument Formats for details.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

double d = 12.34; QString str = QString(“delta: %1”).arg(d, 0, ‘E’, 3); // str == “delta: 1.234E+01”

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used.

If fillChar is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.

See also QLocale::toString().

source

pub unsafe fn arg_double(&self, a: c_double) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(double a) const.

C++ documentation:

This function overloads arg().

Argument a is formatted according to the specified format and precision. See Argument Formats for details.

fieldWidth specifies the minimum amount of space that a is padded to and filled with the character fillChar. A positive value produces right-aligned text; a negative value produces left-aligned text.

double d = 12.34; QString str = QString(“delta: %1”).arg(d, 0, ‘E’, 3); // str == “delta: 1.234E+01”

The '%' can be followed by an 'L', in which case the sequence is replaced with a localized representation of a. The conversion uses the default locale, set by QLocale::setDefault(). If no default locale was specified, the "C" locale is used.

If fillChar is '0' (the number 0, ASCII 48), this function will use the locale's zero to pad. For negative numbers, the zero padding will probably appear before the minus sign.

See also QLocale::toString().

source

pub unsafe fn arg_char_int( &self, a: c_char, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(char a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

The a argument is interpreted as a Latin-1 character.

source

pub unsafe fn arg_char(&self, a: c_char) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(char a) const.

C++ documentation:

This function overloads arg().

The a argument is interpreted as a Latin-1 character.

source

pub unsafe fn arg_q_char_int( &self, a: impl CastInto<Ref<QChar>>, field_width: c_int ) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(QChar a, int fieldWidth = …) const.

C++ documentation:

This function overloads arg().

source

pub unsafe fn arg_q_char(&self, a: impl CastInto<Ref<QChar>>) -> CppBox<QString>

This function overloads arg().

Calls C++ function: QString QString::arg(QChar a) const.

C++ documentation:

This function overloads arg().

source

pub unsafe fn arg_q_string_int( &self, a: impl CastInto<Ref<QString>>, field_width: c_int ) -> CppBox<QString>

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, ..., %99.

Calls C++ function: QString QString::arg(const QString& a, int fieldWidth = …) const.

C++ documentation:

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, …, %99.

fieldWidth specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

QString i; // current file’s number QString total; // number of files to process QString fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest numbered unreplaced place marker, no matter where it appears. Also, if place marker %i appears more than once in the string, the arg() replaces all of them.

If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.

source

pub unsafe fn arg_q_string( &self, a: impl CastInto<Ref<QString>> ) -> CppBox<QString>

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, ..., %99.

Calls C++ function: QString QString::arg(const QString& a) const.

C++ documentation:

Returns a copy of this string with the lowest numbered place marker replaced by string a, i.e., %1, %2, …, %99.

fieldWidth specifies the minimum amount of space that argument a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

QString i; // current file’s number QString total; // number of files to process QString fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest numbered unreplaced place marker, no matter where it appears. Also, if place marker %i appears more than once in the string, the arg() replaces all of them.

If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.

source

pub unsafe fn arg_q_string_view_int_q_char( &self, a: impl CastInto<Ref<QStringView>>, field_width: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QString QString::arg(QStringView a, int fieldWidth = …, QChar fillChar = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

int i; // current file’s number int total; // number of files to process QStringView fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn arg_q_latin1_string_int_q_char( &self, a: impl CastInto<Ref<QLatin1String>>, field_width: c_int, fill_char: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: QString QString::arg(QLatin1String a, int fieldWidth = …, QChar fillChar = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn arg_q_string_view_int( &self, a: impl CastInto<Ref<QStringView>>, field_width: c_int ) -> CppBox<QString>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QString QString::arg(QStringView a, int fieldWidth = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

int i; // current file’s number int total; // number of files to process QStringView fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn arg_q_string_view( &self, a: impl CastInto<Ref<QStringView>> ) -> CppBox<QString>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: QString QString::arg(QStringView a) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

This example shows how we might create a status string for reporting progress while processing a list of files:

int i; // current file’s number int total; // number of files to process QStringView fileName; // current file’s name

QString status = QString(“Processing file %1 of %2: %3”) .arg(i).arg(total).arg(fileName);

First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn arg_q_latin1_string_int( &self, a: impl CastInto<Ref<QLatin1String>>, field_width: c_int ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: QString QString::arg(QLatin1String a, int fieldWidth = …) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn arg_q_latin1_string( &self, a: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: QString QString::arg(QLatin1String a) const.

C++ documentation:

This is an overloaded function.

Returns a copy of this string with the lowest-numbered place-marker replaced by string a, i.e., %1, %2, ..., %99.

fieldWidth specifies the minimum amount of space that a shall occupy. If a requires less space than fieldWidth, it is padded to fieldWidth with character fillChar. A positive fieldWidth produces right-aligned text. A negative fieldWidth produces left-aligned text.

One advantage of using arg() over asprintf() is that the order of the numbered place markers can change, if the application's strings are translated into other languages, but each arg() will still replace the lowest-numbered unreplaced place-marker, no matter where it appears. Also, if place-marker %i appears more than once in the string, arg() replaces all of them.

If there is no unreplaced place-marker remaining, a warning message is printed and the result is undefined. Place-marker numbers must be in the range 1 to 99.

This function was introduced in Qt 5.10.

source

pub unsafe fn at(&self, i: c_int) -> CppBox<QChar>

Returns the character at the given index position in the string.

Calls C++ function: QChar QString::at(int i) const.

C++ documentation:

Returns the character at the given index position in the string.

The position must be a valid index position in the string (i.e., 0 <= position < size()).

See also operator[]().

source

pub unsafe fn back(&self) -> CppBox<QChar>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

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

Calls C++ function: QChar QString::back() const.

C++ documentation:

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

This function is provided for STL compatibility.

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

This function was introduced in Qt 5.10.

See also front(), at(), and operator[]().

source

pub unsafe fn back_mut(&self) -> CppBox<QCharRef>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a reference to the last character in the string. Same as operator[](size() - 1).

Calls C++ function: QCharRef QString::back().

C++ documentation:

Returns a reference to the last character in the string. Same as operator[](size() - 1).

This function is provided for STL compatibility.

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

This function was introduced in Qt 5.10.

See also front(), at(), and operator[]().

source

pub unsafe fn begin_mut(&self) -> Ptr<QChar>

Returns an STL-style iterator pointing to the first character in the string.

Calls C++ function: QChar* QString::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first character in the string.

See also constBegin() and end().

source

pub unsafe fn begin(&self) -> Ptr<QChar>

This function overloads begin().

Calls C++ function: const QChar* QString::begin() const.

C++ documentation:

This function overloads begin().

source

pub unsafe fn capacity(&self) -> c_int

Returns the maximum number of characters that can be stored in the string without forcing a reallocation.

Calls C++ function: int QString::capacity() const.

C++ documentation:

Returns the maximum number of characters that can be stored in the string without forcing a reallocation.

The sole purpose of this function is to provide a means of fine tuning QString's memory usage. In general, you will rarely ever need to call this function. If you want to know how many characters are in the string, call size().

See also reserve() and squeeze().

source

pub unsafe fn cbegin(&self) -> Ptr<QChar>

Returns a const STL-style iterator pointing to the first character in the string.

Calls C++ function: const QChar* QString::cbegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first character in the string.

This function was introduced in Qt 5.0.

See also begin() and cend().

source

pub unsafe fn cend(&self) -> Ptr<QChar>

Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.

Calls C++ function: const QChar* QString::cend() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.

This function was introduced in Qt 5.0.

See also cbegin() and end().

source

pub unsafe fn chop(&self, n: c_int)

Removes n characters from the end of the string.

Calls C++ function: void QString::chop(int n).

C++ documentation:

Removes n characters from the end of the string.

If n is greater than or equal to size(), the result is an empty string; if n is negative, it is equivalent to passing zero.

Example:

QString str(“LOGOUT\r\n”); str.chop(2); // str == “LOGOUT”

If you want to remove characters from the beginning of the string, use remove() instead.

See also truncate(), resize(), remove(), and QStringRef::chop().

source

pub unsafe fn chopped(&self, n: c_int) -> CppBox<QString>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a substring that contains the size() - len leftmost characters of this string.

Calls C++ function: QString QString::chopped(int n) const.

C++ documentation:

Returns a substring that contains the size() - len leftmost characters of this string.

Note: The behavior is undefined if len is negative or greater than size().

This function was introduced in Qt 5.10.

See also endsWith(), left(), right(), mid(), chop(), and truncate().

source

pub unsafe fn clear(&self)

Clears the contents of the string and makes it null.

Calls C++ function: void QString::clear().

C++ documentation:

Clears the contents of the string and makes it null.

See also resize() and isNull().

source

pub unsafe fn compare_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(const QString& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads compare().

Lexically compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.

Same as compare(*this, other, cs).

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_latin1_string_case_sensitivity( &self, other: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(QLatin1String other, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads compare().

Same as compare(*this, other, cs).

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_2_q_string_case_sensitivity( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> c_int

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

Calls C++ function: static int QString::compare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs = …).

C++ documentation:

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.

Case sensitive comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with localeAwareCompare().

int x = QString::compare(“aUtO”, “AuTo”, Qt::CaseInsensitive); // x == 0 int y = QString::compare(“auto”, “Car”, Qt::CaseSensitive); // y > 0 int z = QString::compare(“auto”, “Car”, Qt::CaseInsensitive); // z < 0

This function was introduced in Qt 4.2.

See also operator==(), operator<(), and operator>().

source

pub unsafe fn compare_q_string_q_latin1_string_case_sensitivity( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(const QString& s1, QLatin1String s2, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads compare().

Performs a comparison of s1 and s2, using the case sensitivity setting cs.

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_latin1_string_q_string_case_sensitivity( s1: impl CastInto<Ref<QLatin1String>>, s2: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(QLatin1String s1, const QString& s2, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads compare().

Performs a comparison of s1 and s2, using the case sensitivity setting cs.

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_string_ref_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, cs: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(const QStringRef& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads compare().

Compares the string reference, ref, with the string and returns an integer less than, equal to, or greater than zero if the string is less than, equal to, or greater than ref.

source

pub unsafe fn compare_q_string_q_string_ref_case_sensitivity( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QStringRef>>, arg3: CaseSensitivity ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(const QString& s1, const QStringRef& s2, Qt::CaseSensitivity arg3 = …).

C++ documentation:

This function overloads compare().

source

pub unsafe fn compare_q_string(&self, s: impl CastInto<Ref<QString>>) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(const QString& s) const.

C++ documentation:

This function overloads compare().

Lexically compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.

Same as compare(*this, other, cs).

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_latin1_string( &self, other: impl CastInto<Ref<QLatin1String>> ) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(QLatin1String other) const.

C++ documentation:

This function overloads compare().

Same as compare(*this, other, cs).

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_2_q_string( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QString>> ) -> c_int

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

Calls C++ function: static int QString::compare(const QString& s1, const QString& s2).

C++ documentation:

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

If cs is Qt::CaseSensitive, the comparison is case sensitive; otherwise the comparison is case insensitive.

Case sensitive comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with localeAwareCompare().

int x = QString::compare(“aUtO”, “AuTo”, Qt::CaseInsensitive); // x == 0 int y = QString::compare(“auto”, “Car”, Qt::CaseSensitive); // y > 0 int z = QString::compare(“auto”, “Car”, Qt::CaseInsensitive); // z < 0

This function was introduced in Qt 4.2.

See also operator==(), operator<(), and operator>().

source

pub unsafe fn compare_q_string_q_latin1_string( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QLatin1String>> ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(const QString& s1, QLatin1String s2).

C++ documentation:

This function overloads compare().

Performs a comparison of s1 and s2, using the case sensitivity setting cs.

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_latin1_string_q_string( s1: impl CastInto<Ref<QLatin1String>>, s2: impl CastInto<Ref<QString>> ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(QLatin1String s1, const QString& s2).

C++ documentation:

This function overloads compare().

Performs a comparison of s1 and s2, using the case sensitivity setting cs.

This function was introduced in Qt 4.2.

source

pub unsafe fn compare_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads compare().

Calls C++ function: int QString::compare(const QStringRef& s) const.

C++ documentation:

This function overloads compare().

Compares the string reference, ref, with the string and returns an integer less than, equal to, or greater than zero if the string is less than, equal to, or greater than ref.

source

pub unsafe fn compare_q_string_q_string_ref( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads compare().

Calls C++ function: static int QString::compare(const QString& s1, const QStringRef& s2).

C++ documentation:

This function overloads compare().

source

pub unsafe fn compare_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function overloads compare().

Calls C++ function: int QString::compare(QStringView s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads compare().

Performs a comparison of this with s, using the case sensitivity setting cs.

This function was introduced in Qt 5.12.

source

pub unsafe fn compare_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> c_int

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function overloads compare().

Calls C++ function: int QString::compare(QStringView s) const.

C++ documentation:

This function overloads compare().

Performs a comparison of this with s, using the case sensitivity setting cs.

This function was introduced in Qt 5.12.

source

pub unsafe fn const_begin(&self) -> Ptr<QChar>

Returns a const STL-style iterator pointing to the first character in the string.

Calls C++ function: const QChar* QString::constBegin() const.

C++ documentation:

Returns a const STL-style iterator pointing to the first character in the string.

See also begin() and constEnd().

source

pub unsafe fn const_data(&self) -> Ptr<QChar>

Returns a pointer to the data stored in the QString. The pointer can be used to access the characters that compose the string.

Calls C++ function: const QChar* QString::constData() const.

C++ documentation:

Returns a pointer to the data stored in the QString. The pointer can be used to access the characters that compose the string.

Note that the pointer remains valid only as long as the string is not modified.

Note: The returned string may not be '\0'-terminated. Use size() to determine the length of the array.

See also data(), operator[](), and fromRawData().

source

pub unsafe fn const_end(&self) -> Ptr<QChar>

Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.

Calls C++ function: const QChar* QString::constEnd() const.

C++ documentation:

Returns a const STL-style iterator pointing to the imaginary character after the last character in the list.

See also constBegin() and end().

source

pub unsafe fn contains_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(QChar c, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the character ch; otherwise returns false.

source

pub unsafe fn contains_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> bool

Returns true if this string contains an occurrence of the string str; otherwise returns false.

Calls C++ function: bool QString::contains(const QString& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns true if this string contains an occurrence of the string str; otherwise returns false.

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

Example:

QString str = “Peter Pan”; str.contains(“peter”, Qt::CaseInsensitive); // returns true

See also indexOf() and count().

source

pub unsafe fn contains_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(QLatin1String s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the latin-1 string str; otherwise returns false.

This function was introduced in Qt 5.3.

source

pub unsafe fn contains_q_string_ref_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, cs: CaseSensitivity ) -> bool

Returns true if this string contains an occurrence of the string reference str; otherwise returns false.

Calls C++ function: bool QString::contains(const QStringRef& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns true if this string contains an occurrence of the string reference str; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also indexOf() and count().

source

pub unsafe fn contains_q_reg_exp(&self, rx: impl CastInto<Ref<QRegExp>>) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(const QRegExp& rx) const.

C++ documentation:

This function overloads contains().

Returns true if the regular expression rx matches somewhere in this string; otherwise returns false.

source

pub unsafe fn contains_q_reg_exp2( &self, rx: impl CastInto<Ref<QRegExp>> ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(QRegExp& rx) const.

C++ documentation:

This function overloads contains().

Returns true if the regular expression rx matches somewhere in this string; otherwise returns false.

If there is a match, the rx regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).

This function was introduced in Qt 4.5.

source

pub unsafe fn contains_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(const QRegularExpression& re) const.

C++ documentation:

This function overloads contains().

Returns true if the regular expression re matches somewhere in this string; otherwise returns false.

This function was introduced in Qt 5.0.

source

pub unsafe fn contains_q_regular_expression_q_regular_expression_match( &self, re: impl CastInto<Ref<QRegularExpression>>, match_: impl CastInto<Ptr<QRegularExpressionMatch>> ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(const QRegularExpression& re, QRegularExpressionMatch* match) const.

C++ documentation:

This function overloads contains().

Returns true if the regular expression re matches somewhere in this string; otherwise returns false.

If the match is successful and match is not a null pointer, it also writes the results of the match into the QRegularExpressionMatch object pointed to by match.

This function was introduced in Qt 5.1.

See also QRegularExpression::match().

source

pub unsafe fn contains_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(QChar c) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the character ch; otherwise returns false.

source

pub unsafe fn contains_q_string(&self, s: impl CastInto<Ref<QString>>) -> bool

Returns true if this string contains an occurrence of the string str; otherwise returns false.

Calls C++ function: bool QString::contains(const QString& s) const.

C++ documentation:

Returns true if this string contains an occurrence of the string str; otherwise returns false.

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

Example:

QString str = “Peter Pan”; str.contains(“peter”, Qt::CaseInsensitive); // returns true

See also indexOf() and count().

source

pub unsafe fn contains_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

This function overloads contains().

Calls C++ function: bool QString::contains(QLatin1String s) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the latin-1 string str; otherwise returns false.

This function was introduced in Qt 5.3.

source

pub unsafe fn contains_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> bool

Returns true if this string contains an occurrence of the string reference str; otherwise returns false.

Calls C++ function: bool QString::contains(const QStringRef& s) const.

C++ documentation:

Returns true if this string contains an occurrence of the string reference str; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also indexOf() and count().

source

pub unsafe fn contains_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.14.0" only.

This function overloads contains().

Calls C++ function: bool QString::contains(QStringView s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the string view str; otherwise returns false.

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

This function was introduced in Qt 5.14.

See also indexOf() and count().

source

pub unsafe fn contains_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on cpp_lib_version="5.14.0" only.

This function overloads contains().

Calls C++ function: bool QString::contains(QStringView s) const.

C++ documentation:

This function overloads contains().

Returns true if this string contains an occurrence of the string view str; otherwise returns false.

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

This function was introduced in Qt 5.14.

See also indexOf() and count().

source

pub unsafe fn copy_from_q_char( &self, c: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads operator=().

Calls C++ function: QString& QString::operator=(QChar c).

C++ documentation:

This function overloads operator=().

Sets the string to contain the single character ch.

source

pub unsafe fn copy_from_q_string( &self, arg1: impl CastInto<Ref<QString>> ) -> Ref<QString>

Assigns other to this string and returns a reference to this string.

Calls C++ function: QString& QString::operator=(const QString& arg1).

C++ documentation:

Assigns other to this string and returns a reference to this string.

source

pub unsafe fn copy_from_q_latin1_string( &self, latin1: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads operator=().

Calls C++ function: QString& QString::operator=(QLatin1String latin1).

C++ documentation:

This function overloads operator=().

Assigns the Latin-1 string str to this string.

source

pub unsafe fn copy_from_char(&self, ch: *const c_char) -> Ref<QString>

This function overloads operator=().

Calls C++ function: QString& QString::operator=(const char* ch).

C++ documentation:

This function overloads operator=().

Assigns str to this string. The const char pointer is converted to Unicode using the fromUtf8() function.

You can disable this operator by defining QT_NO_CAST_FROM_ASCII or QT_RESTRICTED_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.

source

pub unsafe fn copy_from_q_byte_array( &self, a: impl CastInto<Ref<QByteArray>> ) -> Ref<QString>

This function overloads operator=().

Calls C++ function: QString& QString::operator=(const QByteArray& a).

C++ documentation:

This function overloads operator=().

Assigns ba to this string. The byte array is converted to Unicode using the fromUtf8() function. This function stops conversion at the first NUL character found, or the end of the ba byte array.

You can disable this operator by defining 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.

source

pub unsafe fn copy_from_char2(&self, c: c_char) -> Ref<QString>

This function overloads operator=().

Calls C++ function: QString& QString::operator=(char c).

C++ documentation:

This function overloads operator=().

Assigns character ch to this string. Note that the character is converted to Unicode using the fromLatin1() function, unlike other 8-bit functions that operate on UTF-8 data.

You can disable this operator by defining 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.

source

pub unsafe fn count(&self) -> c_int

This function overloads count().

Calls C++ function: int QString::count() const.

C++ documentation:

This function overloads count().

Same as size().

source

pub unsafe fn count_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> c_int

This function overloads count().

Calls C++ function: int QString::count(QChar c, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads count().

Returns the number of occurrences of character ch in the string.

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

See also contains() and indexOf().

source

pub unsafe fn count_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> c_int

Returns the number of (potentially overlapping) occurrences of the string str in this string.

Calls C++ function: int QString::count(const QString& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns the number of (potentially overlapping) occurrences of the string str in this string.

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

See also contains() and indexOf().

source

pub unsafe fn count_q_string_ref_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, cs: CaseSensitivity ) -> c_int

This function overloads count().

Calls C++ function: int QString::count(const QStringRef& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads count().

Returns the number of (potentially overlapping) occurrences of the string reference str in this string.

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

This function was introduced in Qt 4.8.

See also contains() and indexOf().

source

pub unsafe fn count_q_reg_exp(&self, arg1: impl CastInto<Ref<QRegExp>>) -> c_int

This function overloads count().

Calls C++ function: int QString::count(const QRegExp& arg1) const.

C++ documentation:

This function overloads count().

Returns the number of times the regular expression rx matches in the string.

This function counts overlapping matches, so in the example below, there are four instances of "ana" or "ama":

QString str = “banana and panama”; str.count(QRegExp(“a[nm]a”)); // returns 4

source

pub unsafe fn count_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> c_int

This function overloads count().

Calls C++ function: int QString::count(const QRegularExpression& re) const.

C++ documentation:

This function overloads count().

Returns the number of times the regular expression re matches in the string.

This function counts overlapping matches, so in the example below, there are four instances of "ana" or "ama":

QString str = “banana and panama”; str.count(QRegularExpression(“a[nm]a”)); // returns 4

This function was introduced in Qt 5.0.

source

pub unsafe fn count_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_int

This function overloads count().

Calls C++ function: int QString::count(QChar c) const.

C++ documentation:

This function overloads count().

Returns the number of occurrences of character ch in the string.

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

See also contains() and indexOf().

source

pub unsafe fn count_q_string(&self, s: impl CastInto<Ref<QString>>) -> c_int

Returns the number of (potentially overlapping) occurrences of the string str in this string.

Calls C++ function: int QString::count(const QString& s) const.

C++ documentation:

Returns the number of (potentially overlapping) occurrences of the string str in this string.

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

See also contains() and indexOf().

source

pub unsafe fn count_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads count().

Calls C++ function: int QString::count(const QStringRef& s) const.

C++ documentation:

This function overloads count().

Returns the number of (potentially overlapping) occurrences of the string reference str in this string.

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

This function was introduced in Qt 4.8.

See also contains() and indexOf().

source

pub unsafe fn data_mut(&self) -> Ptr<QChar>

Returns a pointer to the data stored in the QString. The pointer can be used to access and modify the characters that compose the string.

Calls C++ function: QChar* QString::data().

C++ documentation:

Returns a pointer to the data stored in the QString. The pointer can be used to access and modify the characters that compose the string.

Unlike constData() and unicode(), the returned data is always '\0'-terminated.

Example:

QString str = “Hello world”; QChar *data = str.data(); while (!data->isNull()) { qDebug() << data->unicode(); ++data; }

Note that the pointer remains valid only as long as the string is not modified by other means. For read-only access, constData() is faster because it never causes a deep copy to occur.

See also constData() and operator[]().

source

pub unsafe fn data(&self) -> Ptr<QChar>

This is an overloaded function.

Calls C++ function: const QChar* QString::data() const.

C++ documentation:

This is an overloaded function.

Note: The returned string may not be '\0'-terminated. Use size() to determine the length of the array.

See also fromRawData().

source

pub unsafe fn detach(&self)

Calls C++ function: void QString::detach().

source

pub unsafe fn end_mut(&self) -> Ptr<QChar>

Returns an STL-style iterator pointing to the imaginary character after the last character in the string.

Calls C++ function: QChar* QString::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary character after the last character in the string.

See also begin() and constEnd().

source

pub unsafe fn end(&self) -> Ptr<QChar>

This function overloads end().

Calls C++ function: const QChar* QString::end() const.

C++ documentation:

This function overloads end().

source

pub unsafe fn ends_with_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> bool

Returns true if the string ends with s; otherwise returns false.

Calls C++ function: bool QString::endsWith(const QString& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns true if the string ends with s; otherwise returns false.

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

QString str = “Bananas”; str.endsWith(“anas”); // returns true str.endsWith(“pple”); // returns false

See also startsWith().

source

pub unsafe fn ends_with_q_string_ref_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, cs: CaseSensitivity ) -> bool

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(const QStringRef& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads endsWith().

Returns true if the string ends with the string reference s; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also startsWith().

source

pub unsafe fn ends_with_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads endsWith().

source

pub unsafe fn ends_with_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

Returns true if the string ends with c; otherwise returns false.

Calls C++ function: bool QString::endsWith(QChar c, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns true if the string ends with c; otherwise returns false.

This function overloads endsWith().

source

pub unsafe fn ends_with_q_string(&self, s: impl CastInto<Ref<QString>>) -> bool

Returns true if the string ends with s; otherwise returns false.

Calls C++ function: bool QString::endsWith(const QString& s) const.

C++ documentation:

Returns true if the string ends with s; otherwise returns false.

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

QString str = “Bananas”; str.endsWith(“anas”); // returns true str.endsWith(“pple”); // returns false

See also startsWith().

source

pub unsafe fn ends_with_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> bool

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(const QStringRef& s) const.

C++ documentation:

This function overloads endsWith().

Returns true if the string ends with the string reference s; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also startsWith().

source

pub unsafe fn ends_with_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(QLatin1String s) const.

C++ documentation:

This function overloads endsWith().

source

pub unsafe fn ends_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

Returns true if the string ends with c; otherwise returns false.

Calls C++ function: bool QString::endsWith(QChar c) const.

C++ documentation:

Returns true if the string ends with c; otherwise returns false.

This function overloads endsWith().

source

pub unsafe fn ends_with_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(QStringView s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads endsWith().

Returns true if the string ends with the string view str; otherwise returns false.

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

This function was introduced in Qt 5.10.

See also startsWith().

source

pub unsafe fn ends_with_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function overloads endsWith().

Calls C++ function: bool QString::endsWith(QStringView s) const.

C++ documentation:

This function overloads endsWith().

Returns true if the string ends with the string view str; otherwise returns false.

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

This function was introduced in Qt 5.10.

See also startsWith().

source

pub unsafe fn fill_2a( &self, c: impl CastInto<Ref<QChar>>, size: c_int ) -> Ref<QString>

Sets every character in the string to character ch. If size is different from -1 (default), the string is resized to size beforehand.

Calls C++ function: QString& QString::fill(QChar c, int size = …).

C++ documentation:

Sets every character in the string to character ch. If size is different from -1 (default), the string is resized to size beforehand.

Example:

QString str = “Berlin”; str.fill(‘z’); // str == “zzzzzz”

str.fill(‘A’, 2); // str == “AA”

See also resize().

source

pub unsafe fn fill_1a(&self, c: impl CastInto<Ref<QChar>>) -> Ref<QString>

Sets every character in the string to character ch. If size is different from -1 (default), the string is resized to size beforehand.

Calls C++ function: QString& QString::fill(QChar c).

C++ documentation:

Sets every character in the string to character ch. If size is different from -1 (default), the string is resized to size beforehand.

Example:

QString str = “Berlin”; str.fill(‘z’); // str == “zzzzzz”

str.fill(‘A’, 2); // str == “AA”

See also resize().

source

pub unsafe fn from_latin1_char_int( str: *const c_char, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Latin-1 string str.

Calls C++ function: static QString QString::fromLatin1(const char* str, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the Latin-1 string str.

If size is -1 (default), it is taken to be strlen(str).

See also toLatin1(), fromUtf8(), and fromLocal8Bit().

source

pub unsafe fn from_latin1_q_byte_array( str: impl CastInto<Ref<QByteArray>> ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::fromLatin1(const QByteArray& str).

C++ documentation:

This is an overloaded function.

Returns a QString initialized with the Latin-1 string str.

This function was introduced in Qt 5.0.

source

pub unsafe fn from_latin1_char(str: *const c_char) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Latin-1 string str.

Calls C++ function: static QString QString::fromLatin1(const char* str).

C++ documentation:

Returns a QString initialized with the first size characters of the Latin-1 string str.

If size is -1 (default), it is taken to be strlen(str).

See also toLatin1(), fromUtf8(), and fromLocal8Bit().

source

pub unsafe fn from_local8_bit_char_int( str: *const c_char, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the 8-bit string str.

Calls C++ function: static QString QString::fromLocal8Bit(const char* str, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the 8-bit string str.

If size is -1 (default), it is taken to be strlen(str).

QTextCodec::codecForLocale() is used to perform the conversion.

See also toLocal8Bit(), fromLatin1(), and fromUtf8().

source

pub unsafe fn from_local8_bit_q_byte_array( str: impl CastInto<Ref<QByteArray>> ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::fromLocal8Bit(const QByteArray& str).

C++ documentation:

This is an overloaded function.

Returns a QString initialized with the 8-bit string str.

This function was introduced in Qt 5.0.

source

pub unsafe fn from_local8_bit_char(str: *const c_char) -> CppBox<QString>

Returns a QString initialized with the first size characters of the 8-bit string str.

Calls C++ function: static QString QString::fromLocal8Bit(const char* str).

C++ documentation:

Returns a QString initialized with the first size characters of the 8-bit string str.

If size is -1 (default), it is taken to be strlen(str).

QTextCodec::codecForLocale() is used to perform the conversion.

See also toLocal8Bit(), fromLatin1(), and fromUtf8().

source

pub unsafe fn from_raw_data( arg1: impl CastInto<Ptr<QChar>>, size: c_int ) -> CppBox<QString>

Constructs a QString that uses the first size Unicode characters in the array unicode. The data in unicode is not copied. The caller must be able to guarantee that unicode will not be deleted or modified as long as the QString (or an unmodified copy of it) exists.

Calls C++ function: static QString QString::fromRawData(const QChar* arg1, int size).

C++ documentation:

Constructs a QString that uses the first size Unicode characters in the array unicode. The data in unicode is not copied. The caller must be able to guarantee that unicode will not be deleted or modified as long as the QString (or an unmodified copy of it) exists.

Any attempts to modify the QString or copies of it will cause it to create a deep copy of the data, ensuring that the raw data isn't modified.

Here's an example of how we can use a QRegularExpression on raw data in memory without requiring to copy the data into a QString:

QRegularExpression pattern(“\u00A4”); static const QChar unicode[] = { 0x005A, 0x007F, 0x00A4, 0x0060, 0x1009, 0x0020, 0x0020}; int size = sizeof(unicode) / sizeof(QChar);

QString str = QString::fromRawData(unicode, size); if (str.contains(pattern) { // … }

Warning: A string created with fromRawData() is not '\0'-terminated, unless the raw data contains a '\0' character at position size. This means unicode() will not return a '\0'-terminated string (although utf16() does, at the cost of copying the raw data).

See also fromUtf16() and setRawData().

source

pub unsafe fn from_ucs4_uint_int( arg1: *const c_uint, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UCS-4 encoded).

Calls C++ function: static QString QString::fromUcs4(const unsigned int* arg1, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UCS-4 encoded).

If size is -1 (default), unicode must be terminated with a 0.

This function was introduced in Qt 4.2.

See also toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), and fromStdU32String().

source

pub unsafe fn from_ucs4_char32_t_int( str: *const char32_t, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UCS-4 encoded).

Calls C++ function: static QString QString::fromUcs4(const char32_t* str, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UCS-4 encoded).

If size is -1 (default), str must be terminated with a 0.

This function was introduced in Qt 5.3.

See also toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), and fromStdU32String().

source

pub unsafe fn from_ucs4_uint(arg1: *const c_uint) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UCS-4 encoded).

Calls C++ function: static QString QString::fromUcs4(const unsigned int* arg1).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UCS-4 encoded).

If size is -1 (default), unicode must be terminated with a 0.

This function was introduced in Qt 4.2.

See also toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), and fromStdU32String().

source

pub unsafe fn from_ucs4_char32_t(str: *const char32_t) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UCS-4 encoded).

Calls C++ function: static QString QString::fromUcs4(const char32_t* str).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UCS-4 encoded).

If size is -1 (default), str must be terminated with a 0.

This function was introduced in Qt 5.3.

See also toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), and fromStdU32String().

source

pub unsafe fn from_utf16_ushort_int( arg1: *const c_ushort, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UTF-16 encoded).

Calls C++ function: static QString QString::fromUtf16(const unsigned short* arg1, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UTF-16 encoded).

If size is -1 (default), unicode must be terminated with a 0.

This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed.

This function is slow compared to the other Unicode conversions. Use QString(const QChar *, int) or QString(const QChar *) if possible.

QString makes a deep copy of the Unicode data.

See also utf16(), setUtf16(), and fromStdU16String().

source

pub unsafe fn from_utf16_char16_t_int( str: *const char16_t, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UTF-16 encoded).

Calls C++ function: static QString QString::fromUtf16(const char16_t* str, int size = …).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UTF-16 encoded).

If size is -1 (default), str must be terminated with a 0.

This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed.

This function is slow compared to the other Unicode conversions. Use QString(const QChar *, int) or QString(const QChar *) if possible.

QString makes a deep copy of the Unicode data.

This function was introduced in Qt 5.3.

See also utf16(), setUtf16(), and fromStdU16String().

source

pub unsafe fn from_utf16_ushort(arg1: *const c_ushort) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UTF-16 encoded).

Calls C++ function: static QString QString::fromUtf16(const unsigned short* arg1).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string unicode (ISO-10646-UTF-16 encoded).

If size is -1 (default), unicode must be terminated with a 0.

This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed.

This function is slow compared to the other Unicode conversions. Use QString(const QChar *, int) or QString(const QChar *) if possible.

QString makes a deep copy of the Unicode data.

See also utf16(), setUtf16(), and fromStdU16String().

source

pub unsafe fn from_utf16_char16_t(str: *const char16_t) -> CppBox<QString>

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UTF-16 encoded).

Calls C++ function: static QString QString::fromUtf16(const char16_t* str).

C++ documentation:

Returns a QString initialized with the first size characters of the Unicode string str (ISO-10646-UTF-16 encoded).

If size is -1 (default), str must be terminated with a 0.

This function checks for a Byte Order Mark (BOM). If it is missing, host byte order is assumed.

This function is slow compared to the other Unicode conversions. Use QString(const QChar *, int) or QString(const QChar *) if possible.

QString makes a deep copy of the Unicode data.

This function was introduced in Qt 5.3.

See also utf16(), setUtf16(), and fromStdU16String().

source

pub unsafe fn from_utf8_char_int( str: *const c_char, size: c_int ) -> CppBox<QString>

Returns a QString initialized with the first size bytes of the UTF-8 string str.

Calls C++ function: static QString QString::fromUtf8(const char* str, int size = …).

C++ documentation:

Returns a QString initialized with the first size bytes of the UTF-8 string str.

If size is -1 (default), it is taken to be strlen(str).

UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString. However, invalid sequences are possible with UTF-8 and, if any such are found, they will be replaced with one or more "replacement characters", or suppressed. These include non-Unicode sequences, non-characters, overlong sequences or surrogate codepoints encoded into UTF-8.

This function can be used to process incoming data incrementally as long as all UTF-8 characters are terminated within the incoming data. Any unterminated characters at the end of the string will be replaced or suppressed. In order to do stateful decoding, please use QTextDecoder.

See also toUtf8(), fromLatin1(), and fromLocal8Bit().

source

pub unsafe fn from_utf8_q_byte_array( str: impl CastInto<Ref<QByteArray>> ) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::fromUtf8(const QByteArray& str).

C++ documentation:

This is an overloaded function.

Returns a QString initialized with the UTF-8 string str.

This function was introduced in Qt 5.0.

source

pub unsafe fn from_utf8_char(str: *const c_char) -> CppBox<QString>

Returns a QString initialized with the first size bytes of the UTF-8 string str.

Calls C++ function: static QString QString::fromUtf8(const char* str).

C++ documentation:

Returns a QString initialized with the first size bytes of the UTF-8 string str.

If size is -1 (default), it is taken to be strlen(str).

UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString. However, invalid sequences are possible with UTF-8 and, if any such are found, they will be replaced with one or more "replacement characters", or suppressed. These include non-Unicode sequences, non-characters, overlong sequences or surrogate codepoints encoded into UTF-8.

This function can be used to process incoming data incrementally as long as all UTF-8 characters are terminated within the incoming data. Any unterminated characters at the end of the string will be replaced or suppressed. In order to do stateful decoding, please use QTextDecoder.

See also toUtf8(), fromLatin1(), and fromLocal8Bit().

source

pub unsafe fn from_w_char_array_2a( string: *const wchar_t, size: c_int ) -> CppBox<QString>

Returns a copy of the string, where the encoding of string depends on the size of wchar. If wchar is 4 bytes, the string is interpreted as UCS-4, if wchar is 2 bytes it is interpreted as UTF-16.

Calls C++ function: static QString QString::fromWCharArray(const wchar_t* string, int size = …).

C++ documentation:

Returns a copy of the string, where the encoding of string depends on the size of wchar. If wchar is 4 bytes, the string is interpreted as UCS-4, if wchar is 2 bytes it is interpreted as UTF-16.

If size is -1 (default), the string has to be 0 terminated.

This function was introduced in Qt 4.2.

See also fromUtf16(), fromLatin1(), fromLocal8Bit(), fromUtf8(), fromUcs4(), and fromStdWString().

source

pub unsafe fn from_w_char_array_1a(string: *const wchar_t) -> CppBox<QString>

Returns a copy of the string, where the encoding of string depends on the size of wchar. If wchar is 4 bytes, the string is interpreted as UCS-4, if wchar is 2 bytes it is interpreted as UTF-16.

Calls C++ function: static QString QString::fromWCharArray(const wchar_t* string).

C++ documentation:

Returns a copy of the string, where the encoding of string depends on the size of wchar. If wchar is 4 bytes, the string is interpreted as UCS-4, if wchar is 2 bytes it is interpreted as UTF-16.

If size is -1 (default), the string has to be 0 terminated.

This function was introduced in Qt 4.2.

See also fromUtf16(), fromLatin1(), fromLocal8Bit(), fromUtf8(), fromUcs4(), and fromStdWString().

source

pub unsafe fn front(&self) -> CppBox<QChar>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

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

Calls C++ function: QChar QString::front() const.

C++ documentation:

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

This function is provided for STL compatibility.

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

This function was introduced in Qt 5.10.

See also back(), at(), and operator[]().

source

pub unsafe fn front_mut(&self) -> CppBox<QCharRef>

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns a reference to the first character in the string. Same as operator[](0).

Calls C++ function: QCharRef QString::front().

C++ documentation:

Returns a reference to the first character in the string. Same as operator.

This function is provided for STL compatibility.

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

This function was introduced in Qt 5.10.

See also back(), at(), and operator[]().

source

pub unsafe fn index_int(&self, i: c_int) -> CppBox<QChar>

Returns the character at the specified position in the string as a modifiable reference.

Calls C++ function: QChar QString::operator[](int i) const.

C++ documentation:

Returns the character at the specified position in the string as a modifiable reference.

Example:

QString str;

if (str[0] == QChar(‘?’)) str[0] = QChar(‘_’);

The return value is of type QCharRef, a helper class for QString. When you get an object of type QCharRef, you can use it as if it were a QChar &. If you assign to it, the assignment will apply to the character in the QString from which you got the reference.

See also at().

source

pub unsafe fn index_int_mut(&self, i: c_int) -> CppBox<QCharRef>

Returns the character at the specified position in the string as a modifiable reference.

Calls C++ function: QCharRef QString::operator[](int i).

C++ documentation:

Returns the character at the specified position in the string as a modifiable reference.

Example:

QString str;

if (str[0] == QChar(‘?’)) str[0] = QChar(‘_’);

The return value is of type QCharRef, a helper class for QString. When you get an object of type QCharRef, you can use it as if it were a QChar &. If you assign to it, the assignment will apply to the character in the QString from which you got the reference.

See also at().

source

pub unsafe fn index_uint(&self, i: c_uint) -> CppBox<QChar>

Equivalent to at(position).

Calls C++ function: QChar QString::operator[](unsigned int i) const.

C++ documentation:

Equivalent to at(position).

This function overloads operator[]().

source

pub unsafe fn index_uint_mut(&self, i: c_uint) -> CppBox<QCharRef>

Equivalent to at(position).

Calls C++ function: QCharRef QString::operator[](unsigned int i).

C++ documentation:

Equivalent to at(position).

This function overloads operator[]().

source

pub unsafe fn index_of_q_char_int_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, from: c_int, cs: CaseSensitivity ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QChar c, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the character ch in the string, searching forward from index position from. Returns -1 if ch could not be found.

source

pub unsafe fn index_of_q_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, from: c_int, cs: CaseSensitivity ) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(const QString& s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_latin1_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int, cs: CaseSensitivity ) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(QLatin1String s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

This function was introduced in Qt 4.5.

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_string_ref_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, from: c_int, cs: CaseSensitivity ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QStringRef& s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string reference str in this string, searching forward from index position from. Returns -1 if str is not found.

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

This function was introduced in Qt 4.8.

source

pub unsafe fn index_of_q_reg_exp_int( &self, arg1: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QRegExp& arg1, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression rx in the string, searching forward from index position from. Returns -1 if rx didn't match anywhere.

Example:

QString str = “the minimum”; str.indexOf(QRegExp(“m[aeiou]”), 0); // returns 4

source

pub unsafe fn index_of_q_reg_exp_int2( &self, arg1: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QRegExp& arg1, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression rx in the string, searching forward from index position from. Returns -1 if rx didn't match anywhere.

If there is a match, the rx regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).

Example:

QString str = “the minimum”; str.indexOf(QRegExp(“m[aeiou]”), 0); // returns 4

This function was introduced in Qt 4.5.

source

pub unsafe fn index_of_q_regular_expression_int( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QRegularExpression& re, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression re in the string, searching forward from index position from. Returns -1 if re didn't match anywhere.

Example:

QString str = “the minimum”; str.indexOf(QRegularExpression(“m[aeiou]”), 0); // returns 4

This function was introduced in Qt 5.0.

source

pub unsafe fn index_of_q_regular_expression_int_q_regular_expression_match( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int, rmatch: impl CastInto<Ptr<QRegularExpressionMatch>> ) -> c_int

This is an overloaded function.

Calls C++ function: int QString::indexOf(const QRegularExpression& re, int from, QRegularExpressionMatch* rmatch) const.

C++ documentation:

This is an overloaded function.

Returns the index position of the first match of the regular expression re in the string, searching forward from index position from. Returns -1 if re didn't match anywhere.

If the match is successful and rmatch is not a null pointer, it also writes the results of the match into the QRegularExpressionMatch object pointed to by rmatch.

Example:

QString str = “the minimum”; QRegularExpressionMatch match; str.indexOf(QRegularExpression(“m[aeiou]”), 0, &match); // returns 4 // match.captured() == mi

This function was introduced in Qt 5.5.

source

pub unsafe fn index_of_q_char_int( &self, c: impl CastInto<Ref<QChar>>, from: c_int ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QChar c, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the character ch in the string, searching forward from index position from. Returns -1 if ch could not be found.

source

pub unsafe fn index_of_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QChar c) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the character ch in the string, searching forward from index position from. Returns -1 if ch could not be found.

source

pub unsafe fn index_of_q_string_int( &self, s: impl CastInto<Ref<QString>>, from: c_int ) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(const QString& s, int from = …) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_string(&self, s: impl CastInto<Ref<QString>>) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(const QString& s) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_latin1_string_int( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(QLatin1String s, int from = …) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

This function was introduced in Qt 4.5.

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> c_int

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

Calls C++ function: int QString::indexOf(QLatin1String s) const.

C++ documentation:

Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.

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

Example:

QString x = “sticky question”; QString y = “sti”; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1

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

This function was introduced in Qt 4.5.

See also lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_string_ref_int( &self, s: impl CastInto<Ref<QStringRef>>, from: c_int ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QStringRef& s, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string reference str in this string, searching forward from index position from. Returns -1 if str is not found.

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

This function was introduced in Qt 4.8.

source

pub unsafe fn index_of_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QStringRef& s) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string reference str in this string, searching forward from index position from. Returns -1 if str is not found.

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

This function was introduced in Qt 4.8.

source

pub unsafe fn index_of_q_reg_exp( &self, arg1: impl CastInto<Ref<QRegExp>> ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QRegExp& arg1) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression rx in the string, searching forward from index position from. Returns -1 if rx didn't match anywhere.

Example:

QString str = “the minimum”; str.indexOf(QRegExp(“m[aeiou]”), 0); // returns 4

source

pub unsafe fn index_of_q_reg_exp2( &self, arg1: impl CastInto<Ref<QRegExp>> ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QRegExp& arg1) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression rx in the string, searching forward from index position from. Returns -1 if rx didn't match anywhere.

If there is a match, the rx regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).

Example:

QString str = “the minimum”; str.indexOf(QRegExp(“m[aeiou]”), 0); // returns 4

This function was introduced in Qt 4.5.

source

pub unsafe fn index_of_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> c_int

This function overloads indexOf().

Calls C++ function: int QString::indexOf(const QRegularExpression& re) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first match of the regular expression re in the string, searching forward from index position from. Returns -1 if re didn't match anywhere.

Example:

QString str = “the minimum”; str.indexOf(QRegularExpression(“m[aeiou]”), 0); // returns 4

This function was introduced in Qt 5.0.

source

pub unsafe fn index_of_q_string_view_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QStringView s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string view str in this string, searching forward from index position from. Returns -1 if str is not found.

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

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

This function was introduced in Qt 5.14.

See also QStringView::indexOf(), lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_string_view_int( &self, s: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QStringView s, int from = …) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string view str in this string, searching forward from index position from. Returns -1 if str is not found.

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

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

This function was introduced in Qt 5.14.

See also QStringView::indexOf(), lastIndexOf(), contains(), and count().

source

pub unsafe fn index_of_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads indexOf().

Calls C++ function: int QString::indexOf(QStringView s) const.

C++ documentation:

This function overloads indexOf().

Returns the index position of the first occurrence of the string view str in this string, searching forward from index position from. Returns -1 if str is not found.

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

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

This function was introduced in Qt 5.14.

See also QStringView::indexOf(), lastIndexOf(), contains(), and count().

source

pub unsafe fn insert_int_q_char( &self, i: c_int, c: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, QChar c).

C++ documentation:

This function overloads insert().

Inserts ch at the given index position in the string.

source

pub unsafe fn insert_int_q_char_int( &self, i: c_int, uc: impl CastInto<Ptr<QChar>>, len: c_int ) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, const QChar* uc, int len).

C++ documentation:

This function overloads insert().

Inserts the first size characters of the QChar array unicode at the given index position in the string.

source

pub unsafe fn insert_int_q_string( &self, i: c_int, s: impl CastInto<Ref<QString>> ) -> Ref<QString>

Inserts the string str at the given index position and returns a reference to this string.

Calls C++ function: QString& QString::insert(int i, const QString& s).

C++ documentation:

Inserts the string str at the given index position and returns a reference to this string.

Example:

QString str = “Meal”; str.insert(1, QString(“ontr”)); // str == “Montreal”

If the given position is greater than size(), the array is first extended using resize().

See also append(), prepend(), replace(), and remove().

source

pub unsafe fn insert_int_q_string_ref( &self, i: c_int, s: impl CastInto<Ref<QStringRef>> ) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, const QStringRef& s).

C++ documentation:

This function overloads insert().

Inserts the string reference str at the given index position and returns a reference to this string.

If the given position is greater than size(), the array is first extended using resize().

This function was introduced in Qt 5.5.

source

pub unsafe fn insert_int_q_latin1_string( &self, i: c_int, s: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, QLatin1String s).

C++ documentation:

This function overloads insert().

Inserts the Latin-1 string str at the given index position.

source

pub unsafe fn insert_int_char(&self, i: c_int, s: *const c_char) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, const char* s).

C++ documentation:

This function overloads insert().

Inserts the C string str at the given index position and returns a reference to this string.

If the given position is greater than size(), the array is first extended using resize().

This function is not available when QT_NO_CAST_FROM_ASCII is defined.

This function was introduced in Qt 5.5.

source

pub unsafe fn insert_int_q_byte_array( &self, i: c_int, s: impl CastInto<Ref<QByteArray>> ) -> Ref<QString>

This function overloads insert().

Calls C++ function: QString& QString::insert(int i, const QByteArray& s).

C++ documentation:

This function overloads insert().

Inserts the byte array str at the given index position and returns a reference to this string.

If the given position is greater than size(), the array is first extended using resize().

This function is not available when QT_NO_CAST_FROM_ASCII is defined.

This function was introduced in Qt 5.5.

source

pub unsafe fn is_detached(&self) -> bool

Calls C++ function: bool QString::isDetached() const.

source

pub unsafe fn is_empty(&self) -> bool

Returns true if the string has no characters; otherwise returns false.

Calls C++ function: bool QString::isEmpty() const.

C++ documentation:

Returns true if the string has no characters; otherwise returns false.

Example:

QString().isEmpty(); // returns true QString(“”).isEmpty(); // returns true QString(“x”).isEmpty(); // returns false QString(“abc”).isEmpty(); // returns false

See also size().

source

pub unsafe fn is_lower(&self) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if the string only contains lowercase letters, otherwise returns false.

Calls C++ function: bool QString::isLower() const.

C++ documentation:

Returns true if the string only contains lowercase letters, otherwise returns false.

This function was introduced in Qt 5.12.

See also QChar::isLower() and isUpper().

source

pub unsafe fn is_null(&self) -> bool

Returns true if this string is null; otherwise returns false.

Calls C++ function: bool QString::isNull() const.

C++ documentation:

Returns true if this string is null; otherwise returns false.

Example:

QString().isNull(); // returns true QString(“”).isNull(); // returns false QString(“abc”).isNull(); // returns false

Qt makes a distinction between null strings and empty strings for historical reasons. For most applications, what matters is whether or not a string contains any data, and this can be determined using the isEmpty() function.

See also isEmpty().

source

pub unsafe fn is_right_to_left(&self) -> bool

Returns true if the string is read right to left.

Calls C++ function: bool QString::isRightToLeft() const.

C++ documentation:

Returns true if the string is read right to left.

See also QStringRef::isRightToLeft().

source

pub unsafe fn is_shared_with(&self, other: impl CastInto<Ref<QString>>) -> bool

Calls C++ function: bool QString::isSharedWith(const QString& other) const.

source

pub unsafe fn is_simple_text(&self) -> bool

Calls C++ function: bool QString::isSimpleText() const.

source

pub unsafe fn is_upper(&self) -> bool

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns true if the string only contains uppercase letters, otherwise returns false.

Calls C++ function: bool QString::isUpper() const.

C++ documentation:

Returns true if the string only contains uppercase letters, otherwise returns false.

This function was introduced in Qt 5.12.

See also QChar::isUpper() and isLower().

source

pub unsafe fn last_index_of_q_char_int_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, from: c_int, cs: CaseSensitivity ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QChar c, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the character ch, searching backward from position from.

source

pub unsafe fn last_index_of_q_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, from: c_int, cs: CaseSensitivity ) -> c_int

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

Calls C++ function: int QString::lastIndexOf(const QString& s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_latin1_string_int_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int, cs: CaseSensitivity ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QLatin1String s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

This function was introduced in Qt 4.5.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string_ref_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, from: c_int, cs: CaseSensitivity ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QStringRef& s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string reference str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 4.8.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_reg_exp_int( &self, arg1: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QRegExp& arg1, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression rx in the string, searching backward from index position from. Returns -1 if rx didn't match anywhere.

Example:

QString str = “the minimum”; str.lastIndexOf(QRegExp(“m[aeiou]”)); // returns 8

source

pub unsafe fn last_index_of_q_reg_exp_int2( &self, arg1: impl CastInto<Ref<QRegExp>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QRegExp& arg1, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression rx in the string, searching backward from index position from. Returns -1 if rx didn't match anywhere.

If there is a match, the rx regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).

Example:

QString str = “the minimum”; str.lastIndexOf(QRegExp(“m[aeiou]”)); // returns 8

This function was introduced in Qt 4.5.

source

pub unsafe fn last_index_of_q_regular_expression_int( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QRegularExpression& re, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression re in the string, which starts before the index position from. Returns -1 if re didn't match anywhere.

Example:

QString str = “the minimum”; str.lastIndexOf(QRegularExpression(“m[aeiou]”)); // returns 8

This function was introduced in Qt 5.0.

source

pub unsafe fn last_index_of_q_regular_expression_int_q_regular_expression_match( &self, re: impl CastInto<Ref<QRegularExpression>>, from: c_int, rmatch: impl CastInto<Ptr<QRegularExpressionMatch>> ) -> c_int

This is an overloaded function.

Calls C++ function: int QString::lastIndexOf(const QRegularExpression& re, int from, QRegularExpressionMatch* rmatch) const.

C++ documentation:

This is an overloaded function.

Returns the index position of the last match of the regular expression re in the string, which starts before the index position from. Returns -1 if re didn't match anywhere.

If the match is successful and rmatch is not a null pointer, it also writes the results of the match into the QRegularExpressionMatch object pointed to by rmatch.

Example:

QString str = “the minimum”; QRegularExpressionMatch match; str.lastIndexOf(QRegularExpression(“m[aeiou]”), -1, &match); // returns 8 // match.captured() == mu

This function was introduced in Qt 5.5.

source

pub unsafe fn last_index_of_q_char_int( &self, c: impl CastInto<Ref<QChar>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QChar c, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the character ch, searching backward from position from.

source

pub unsafe fn last_index_of_q_char(&self, c: impl CastInto<Ref<QChar>>) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QChar c) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the character ch, searching backward from position from.

source

pub unsafe fn last_index_of_q_string_int( &self, s: impl CastInto<Ref<QString>>, from: c_int ) -> c_int

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

Calls C++ function: int QString::lastIndexOf(const QString& s, int from = …) const.

C++ documentation:

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string( &self, s: impl CastInto<Ref<QString>> ) -> c_int

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

Calls C++ function: int QString::lastIndexOf(const QString& s) const.

C++ documentation:

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_latin1_string_int( &self, s: impl CastInto<Ref<QLatin1String>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QLatin1String s, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

This function was introduced in Qt 4.5.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QLatin1String s) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If 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 is not found.

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

Example:

QString x = “crazy azimuths”; QString y = “az”; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1

This function was introduced in Qt 4.5.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string_ref_int( &self, s: impl CastInto<Ref<QStringRef>>, from: c_int ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QStringRef& s, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string reference str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 4.8.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QStringRef& s) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string reference str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 4.8.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_reg_exp( &self, arg1: impl CastInto<Ref<QRegExp>> ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QRegExp& arg1) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression rx in the string, searching backward from index position from. Returns -1 if rx didn't match anywhere.

Example:

QString str = “the minimum”; str.lastIndexOf(QRegExp(“m[aeiou]”)); // returns 8

source

pub unsafe fn last_index_of_q_reg_exp2( &self, arg1: impl CastInto<Ref<QRegExp>> ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QRegExp& arg1) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression rx in the string, searching backward from index position from. Returns -1 if rx didn't match anywhere.

If there is a match, the rx regular expression will contain the matched captures (see QRegExp::matchedLength, QRegExp::cap).

Example:

QString str = “the minimum”; str.lastIndexOf(QRegExp(“m[aeiou]”)); // returns 8

This function was introduced in Qt 4.5.

source

pub unsafe fn last_index_of_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> c_int

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(const QRegularExpression& re) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last match of the regular expression re in the string, which starts before the index position from. Returns -1 if re didn't match anywhere.

Example:

QString str = “the minimum”; str.lastIndexOf(QRegularExpression(“m[aeiou]”)); // returns 8

This function was introduced in Qt 5.0.

source

pub unsafe fn last_index_of_q_string_view_int_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, from: c_int, cs: CaseSensitivity ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QStringView s, int from = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string view str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 5.14.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string_view_int( &self, s: impl CastInto<Ref<QStringView>>, from: c_int ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QStringView s, int from = …) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string view str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 5.14.

See also indexOf(), contains(), and count().

source

pub unsafe fn last_index_of_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> c_int

Available on cpp_lib_version="5.14.0" only.

This function overloads lastIndexOf().

Calls C++ function: int QString::lastIndexOf(QStringView s) const.

C++ documentation:

This function overloads lastIndexOf().

Returns the index position of the last occurrence of the string view str in this string, searching backward from index position from. If 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 is not found.

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

This function was introduced in Qt 5.14.

See also indexOf(), contains(), and count().

source

pub unsafe fn left(&self, n: c_int) -> CppBox<QString>

Returns a substring that contains the n leftmost characters of the string.

Calls C++ function: QString QString::left(int n) const.

C++ documentation:

Returns a substring that contains the n leftmost characters of the string.

The entire string is returned if n is greater than or equal to size(), or less than zero.

QString x = “Pineapple”; QString y = x.left(4); // y == “Pine”

See also right(), mid(), and startsWith().

source

pub unsafe fn left_justified_3a( &self, width: c_int, fill: impl CastInto<Ref<QChar>>, trunc: bool ) -> CppBox<QString>

Returns a string of size width that contains this string padded by the fill character.

Calls C++ function: QString QString::leftJustified(int width, QChar fill = …, bool trunc = …) const.

C++ documentation:

Returns a string of size width that contains this string padded by the fill character.

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

QString s = “apple”; QString t = s.leftJustified(8, ‘.’); // t == “apple…”

If truncate is true and the size() of the string is more than width, then any characters in a copy of the string after position width are removed, and the copy is returned.

QString str = “Pineapple”; str = str.leftJustified(5, ‘.’, true); // str == “Pinea”

See also rightJustified().

source

pub unsafe fn left_justified_2a( &self, width: c_int, fill: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

Returns a string of size width that contains this string padded by the fill character.

Calls C++ function: QString QString::leftJustified(int width, QChar fill = …) const.

C++ documentation:

Returns a string of size width that contains this string padded by the fill character.

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

QString s = “apple”; QString t = s.leftJustified(8, ‘.’); // t == “apple…”

If truncate is true and the size() of the string is more than width, then any characters in a copy of the string after position width are removed, and the copy is returned.

QString str = “Pineapple”; str = str.leftJustified(5, ‘.’, true); // str == “Pinea”

See also rightJustified().

source

pub unsafe fn left_justified_1a(&self, width: c_int) -> CppBox<QString>

Returns a string of size width that contains this string padded by the fill character.

Calls C++ function: QString QString::leftJustified(int width) const.

C++ documentation:

Returns a string of size width that contains this string padded by the fill character.

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

QString s = “apple”; QString t = s.leftJustified(8, ‘.’); // t == “apple…”

If truncate is true and the size() of the string is more than width, then any characters in a copy of the string after position width are removed, and the copy is returned.

QString str = “Pineapple”; str = str.leftJustified(5, ‘.’, true); // str == “Pinea”

See also rightJustified().

source

pub unsafe fn left_ref(&self, n: c_int) -> CppBox<QStringRef>

Returns a substring reference to the n leftmost characters of the string.

Calls C++ function: QStringRef QString::leftRef(int n) const.

C++ documentation:

Returns a substring reference to the n leftmost characters of the string.

If n is greater than or equal to size(), or less than zero, a reference to the entire string is returned.

QString x = “Pineapple”; QStringRef y = x.leftRef(4); // y == “Pine”

This function was introduced in Qt 4.4.

See also left(), rightRef(), midRef(), and startsWith().

source

pub unsafe fn length(&self) -> c_int

Returns the number of characters in this string. Equivalent to size().

Calls C++ function: int QString::length() const.

C++ documentation:

Returns the number of characters in this string. Equivalent to size().

See also resize().

source

pub unsafe fn locale_aware_compare_q_string( &self, s: impl CastInto<Ref<QString>> ) -> c_int

This function overloads localeAwareCompare().

Calls C++ function: int QString::localeAwareCompare(const QString& s) const.

C++ documentation:

This function overloads localeAwareCompare().

Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.

The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.

Same as localeAwareCompare(*this, other).

source

pub unsafe fn locale_aware_compare_2_q_string( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QString>> ) -> c_int

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

Calls C++ function: static int QString::localeAwareCompare(const QString& s1, const QString& s2).

C++ documentation:

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.

On macOS and iOS this function compares according the "Order for sorted lists" setting in the International preferences panel.

See also compare() and QLocale.

source

pub unsafe fn locale_aware_compare_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads localeAwareCompare().

Calls C++ function: int QString::localeAwareCompare(const QStringRef& s) const.

C++ documentation:

This function overloads localeAwareCompare().

Compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.

The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.

Same as localeAwareCompare(*this, other).

This function was introduced in Qt 4.5.

source

pub unsafe fn locale_aware_compare_q_string_q_string_ref( s1: impl CastInto<Ref<QString>>, s2: impl CastInto<Ref<QStringRef>> ) -> c_int

This function overloads localeAwareCompare().

Calls C++ function: static int QString::localeAwareCompare(const QString& s1, const QStringRef& s2).

C++ documentation:

This function overloads localeAwareCompare().

Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less than, equal to, or greater than s2.

The comparison is performed in a locale- and also platform-dependent manner. Use this function to present sorted lists of strings to the user.

This function was introduced in Qt 4.5.

source

pub unsafe fn mid_2a(&self, position: c_int, n: c_int) -> CppBox<QString>

Returns a string that contains n characters of this string, starting at the specified position index.

Calls C++ function: QString QString::mid(int position, int n = …) const.

C++ documentation:

Returns a string that contains n characters of this string, starting at the specified position index.

Returns a null string if the position index exceeds the length of the string. If there are less than n characters available in the string starting at the given position, or if n is -1 (default), the function returns all characters that are available from the specified position.

Example:

QString x = “Nine pineapples”; QString y = x.mid(5, 4); // y == “pine” QString z = x.mid(5); // z == “pineapples”

See also left() and right().

source

pub unsafe fn mid_1a(&self, position: c_int) -> CppBox<QString>

Returns a string that contains n characters of this string, starting at the specified position index.

Calls C++ function: QString QString::mid(int position) const.

C++ documentation:

Returns a string that contains n characters of this string, starting at the specified position index.

Returns a null string if the position index exceeds the length of the string. If there are less than n characters available in the string starting at the given position, or if n is -1 (default), the function returns all characters that are available from the specified position.

Example:

QString x = “Nine pineapples”; QString y = x.mid(5, 4); // y == “pine” QString z = x.mid(5); // z == “pineapples”

See also left() and right().

source

pub unsafe fn mid_ref_2a(&self, position: c_int, n: c_int) -> CppBox<QStringRef>

Returns a substring reference to n characters of this string, starting at the specified position.

Calls C++ function: QStringRef QString::midRef(int position, int n = …) const.

C++ documentation:

Returns a substring reference to n characters of this string, starting at the specified position.

If the position exceeds the length of the string, a null reference is returned.

If there are less than n characters available in the string, starting at the given position, or if n is -1 (default), the function returns all characters from the specified position onwards.

Example:

QString x = “Nine pineapples”; QStringRef y = x.midRef(5, 4); // y == “pine” QStringRef z = x.midRef(5); // z == “pineapples”

This function was introduced in Qt 4.4.

See also mid(), leftRef(), and rightRef().

source

pub unsafe fn mid_ref_1a(&self, position: c_int) -> CppBox<QStringRef>

Returns a substring reference to n characters of this string, starting at the specified position.

Calls C++ function: QStringRef QString::midRef(int position) const.

C++ documentation:

Returns a substring reference to n characters of this string, starting at the specified position.

If the position exceeds the length of the string, a null reference is returned.

If there are less than n characters available in the string, starting at the given position, or if n is -1 (default), the function returns all characters from the specified position onwards.

Example:

QString x = “Nine pineapples”; QStringRef y = x.midRef(5, 4); // y == “pine” QStringRef z = x.midRef(5); // z == “pineapples”

This function was introduced in Qt 4.4.

See also mid(), leftRef(), and rightRef().

source

pub unsafe fn new() -> CppBox<QString>

Constructs a null string. Null strings are also empty.

Calls C++ function: [constructor] void QString::QString().

C++ documentation:

Constructs a null string. Null strings are also empty.

See also isEmpty().

source

pub unsafe fn from_q_char_int( unicode: impl CastInto<Ptr<QChar>>, size: c_int ) -> CppBox<QString>

Constructs a string initialized with the first size characters of the QChar array unicode.

Calls C++ function: [constructor] void QString::QString(const QChar* unicode, int size = …).

C++ documentation:

Constructs a string initialized with the first size characters of the QChar array unicode.

If unicode is 0, a null string is constructed.

If size is negative, unicode is assumed to point to a nul-terminated array and its length is determined dynamically. The terminating nul-character is not considered part of the string.

QString makes a deep copy of the string data. The unicode data is copied as is and the Byte Order Mark is preserved if present.

See also fromRawData().

source

pub unsafe fn from_q_char(c: impl CastInto<Ref<QChar>>) -> CppBox<QString>

Constructs a string of size 1 containing the character ch.

Calls C++ function: [constructor] void QString::QString(QChar c).

C++ documentation:

Constructs a string of size 1 containing the character ch.

source

pub unsafe fn from_int_q_char( size: c_int, c: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

Constructs a string of the given size with every character set to ch.

Calls C++ function: [constructor] void QString::QString(int size, QChar c).

C++ documentation:

Constructs a string of the given size with every character set to ch.

See also fill().

source

pub unsafe fn from_q_latin1_string( latin1: impl CastInto<Ref<QLatin1String>> ) -> CppBox<QString>

Constructs a copy of the Latin-1 string str.

Calls C++ function: [constructor] void QString::QString(QLatin1String latin1).

C++ documentation:

Constructs a copy of the Latin-1 string str.

See also fromLatin1().

source

pub unsafe fn from_char(ch: *const c_char) -> CppBox<QString>

Constructs a string initialized with the 8-bit string str. The given const char pointer is converted to Unicode using the fromUtf8() function.

Calls C++ function: [constructor] void QString::QString(const char* ch).

C++ documentation:

Constructs a string initialized with the 8-bit string str. The given const char pointer is converted to Unicode using the fromUtf8() function.

You can disable this constructor by defining 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.

Note: Defining QT_RESTRICTED_CAST_FROM_ASCII also disables this constructor, but enables a QString(const char (&ch)[N]) constructor instead. Using non-literal input, or input with embedded NUL characters, or non-7-bit characters is undefined in this case.

See also fromLatin1(), fromLocal8Bit(), and fromUtf8().

source

pub unsafe fn from_q_byte_array( a: impl CastInto<Ref<QByteArray>> ) -> CppBox<QString>

Constructs a string initialized with the byte array ba. The given byte array is converted to Unicode using fromUtf8(). Stops copying at the first 0 character, otherwise copies the entire byte array.

Calls C++ function: [constructor] void QString::QString(const QByteArray& a).

C++ documentation:

Constructs a string initialized with the byte array ba. The given byte array is converted to Unicode using fromUtf8(). Stops copying at the first 0 character, otherwise copies the entire byte array.

You can disable this constructor by defining 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.

See also fromLatin1(), fromLocal8Bit(), and fromUtf8().

source

pub unsafe fn from_q_char2( unicode: impl CastInto<Ptr<QChar>> ) -> CppBox<QString>

Constructs a string initialized with the first size characters of the QChar array unicode.

Calls C++ function: [constructor] void QString::QString(const QChar* unicode).

C++ documentation:

Constructs a string initialized with the first size characters of the QChar array unicode.

If unicode is 0, a null string is constructed.

If size is negative, unicode is assumed to point to a nul-terminated array and its length is determined dynamically. The terminating nul-character is not considered part of the string.

QString makes a deep copy of the string data. The unicode data is copied as is and the Byte Order Mark is preserved if present.

See also fromRawData().

source

pub unsafe fn new_copy(arg1: impl CastInto<Ref<QString>>) -> CppBox<QString>

Constructs a copy of other.

Calls C++ function: [constructor] void QString::QString(const QString& arg1).

C++ documentation:

Constructs a copy of other.

This operation takes constant time, because QString is implicitly shared. This makes returning a QString from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.

See also operator=().

source

pub unsafe fn normalized_2a( &self, mode: NormalizationForm, version: UnicodeVersion ) -> CppBox<QString>

Returns the string in the given Unicode normalization mode, according to the given version of the Unicode standard.

Calls C++ function: QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersion version = …) const.

C++ documentation:

Returns the string in the given Unicode normalization mode, according to the given version of the Unicode standard.

source

pub unsafe fn normalized_1a(&self, mode: NormalizationForm) -> CppBox<QString>

Returns the string in the given Unicode normalization mode, according to the given version of the Unicode standard.

Calls C++ function: QString QString::normalized(QString::NormalizationForm mode) const.

C++ documentation:

Returns the string in the given Unicode normalization mode, according to the given version of the Unicode standard.

source

pub unsafe fn number_2_int(arg1: c_int, base: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(int arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_uint_int(arg1: c_uint, base: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(unsigned int arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_long_int(arg1: c_long, base: c_int) -> CppBox<QString>

Returns a string equivalent of the number n according to the specified base.

Calls C++ function: static QString QString::number(long arg1, int base = …).

C++ documentation:

Returns a string equivalent of the number n according to the specified base.

The base is 10 by default and must be between 2 and 36. For bases other than 10, n is treated as an unsigned integer.

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

long a = 63; QString s = QString::number(a, 16); // s == “3f” QString t = QString::number(a, 16).toUpper(); // t == “3F”

See also setNum().

source

pub unsafe fn number_ulong_int(arg1: c_ulong, base: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(unsigned long arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_i64_int(arg1: i64, base: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(qlonglong arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_u64_int(arg1: u64, base: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(qulonglong arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_double_char_int( arg1: c_double, f: c_char, prec: c_int ) -> CppBox<QString>

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Calls C++ function: static QString QString::number(double arg1, char f = …, int prec = …).

C++ documentation:

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Unlike QLocale::toString(), this function does not honor the user's locale settings.

See also setNum() and QLocale::toString().

source

pub unsafe fn number_int(arg1: c_int) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(int arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_uint(arg1: c_uint) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(unsigned int arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_long(arg1: c_long) -> CppBox<QString>

Returns a string equivalent of the number n according to the specified base.

Calls C++ function: static QString QString::number(long arg1).

C++ documentation:

Returns a string equivalent of the number n according to the specified base.

The base is 10 by default and must be between 2 and 36. For bases other than 10, n is treated as an unsigned integer.

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

long a = 63; QString s = QString::number(a, 16); // s == “3f” QString t = QString::number(a, 16).toUpper(); // t == “3F”

See also setNum().

source

pub unsafe fn number_ulong(arg1: c_ulong) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(unsigned long arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_i64(arg1: i64) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(qlonglong arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_u64(arg1: u64) -> CppBox<QString>

This is an overloaded function.

Calls C++ function: static QString QString::number(qulonglong arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn number_double_char(arg1: c_double, f: c_char) -> CppBox<QString>

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Calls C++ function: static QString QString::number(double arg1, char f = …).

C++ documentation:

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Unlike QLocale::toString(), this function does not honor the user's locale settings.

See also setNum() and QLocale::toString().

source

pub unsafe fn number_double(arg1: c_double) -> CppBox<QString>

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Calls C++ function: static QString QString::number(double arg1).

C++ documentation:

Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.

Unlike QLocale::toString(), this function does not honor the user's locale settings.

See also setNum() and QLocale::toString().

source

pub unsafe fn prepend_q_char( &self, c: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(QChar c).

C++ documentation:

This function overloads prepend().

Prepends the character ch to this string.

source

pub unsafe fn prepend_q_char_int( &self, uc: impl CastInto<Ptr<QChar>>, len: c_int ) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(const QChar* uc, int len).

C++ documentation:

This function overloads prepend().

Prepends len characters from the QChar array str to this string and returns a reference to this string.

This function was introduced in Qt 5.5.

source

pub unsafe fn prepend_q_string( &self, s: impl CastInto<Ref<QString>> ) -> Ref<QString>

Prepends the string str to the beginning of this string and returns a reference to this string.

Calls C++ function: QString& QString::prepend(const QString& s).

C++ documentation:

Prepends the string str to the beginning of this string and returns a reference to this string.

Example:

QString x = “ship”; QString y = “air”; x.prepend(y); // x == “airship”

See also append() and insert().

source

pub unsafe fn prepend_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(const QStringRef& s).

C++ documentation:

This function overloads prepend().

Prepends the string reference str to the beginning of this string and returns a reference to this string.

This function was introduced in Qt 5.5.

source

pub unsafe fn prepend_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(QLatin1String s).

C++ documentation:

This function overloads prepend().

Prepends the Latin-1 string str to this string.

source

pub unsafe fn prepend_char(&self, s: *const c_char) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(const char* s).

C++ documentation:

This function overloads prepend().

Prepends the string str to this string. The const char pointer is converted to Unicode using the fromUtf8() function.

You can disable this function by defining 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.

source

pub unsafe fn prepend_q_byte_array( &self, s: impl CastInto<Ref<QByteArray>> ) -> Ref<QString>

This function overloads prepend().

Calls C++ function: QString& QString::prepend(const QByteArray& s).

C++ documentation:

This function overloads prepend().

Prepends the byte array ba to this string. The byte array is converted to Unicode using the fromUtf8() function.

You can disable this function by defining 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.

source

pub unsafe fn push_back_q_char(&self, c: impl CastInto<Ref<QChar>>)

This is an overloaded function.

Calls C++ function: void QString::push_back(QChar c).

C++ documentation:

This is an overloaded function.

Appends the given ch character onto the end of this string.

source

pub unsafe fn push_back_q_string(&self, s: impl CastInto<Ref<QString>>)

This function is provided for STL compatibility, appending the given other string onto the end of this string. It is equivalent to append(other).

Calls C++ function: void QString::push_back(const QString& s).

C++ documentation:

This function is provided for STL compatibility, appending the given other string onto the end of this string. It is equivalent to append(other).

See also append().

source

pub unsafe fn push_front_q_char(&self, c: impl CastInto<Ref<QChar>>)

This is an overloaded function.

Calls C++ function: void QString::push_front(QChar c).

C++ documentation:

This is an overloaded function.

Prepends the given ch character to the beginning of this string.

source

pub unsafe fn push_front_q_string(&self, s: impl CastInto<Ref<QString>>)

This function is provided for STL compatibility, prepending the given other string to the beginning of this string. It is equivalent to prepend(other).

Calls C++ function: void QString::push_front(const QString& s).

C++ documentation:

This function is provided for STL compatibility, prepending the given other string to the beginning of this string. It is equivalent to prepend(other).

See also prepend().

source

pub unsafe fn remove_2_int(&self, i: c_int, len: c_int) -> Ref<QString>

Removes n characters from the string, starting at the given position index, and returns a reference to the string.

Calls C++ function: QString& QString::remove(int i, int len).

C++ documentation:

Removes n characters from the string, starting at the given position index, and returns a reference to the string.

If the specified position index is within the string, but position + n is beyond the end of the string, the string is truncated at the specified position.

QString s = “Montreal”; s.remove(1, 4); // s == “Meal”

See also insert() and replace().

source

pub unsafe fn remove_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> Ref<QString>

Removes every occurrence of the character ch in this string, and returns a reference to this string.

Calls C++ function: QString& QString::remove(QChar c, Qt::CaseSensitivity cs = …).

C++ documentation:

Removes every occurrence of the character ch in this string, and returns a reference to this string.

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

Example:

QString t = “Ali Baba”; t.remove(QChar(‘a’), Qt::CaseInsensitive); // t == “li Bb”

This is the same as replace(ch, "", cs).

See also replace().

source

pub unsafe fn remove_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> Ref<QString>

Removes every occurrence of the given str string in this string, and returns a reference to this string.

Calls C++ function: QString& QString::remove(const QString& s, Qt::CaseSensitivity cs = …).

C++ documentation:

Removes every occurrence of the given str string in this string, and returns a reference to this string.

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

This is the same as replace(str, "", cs).

See also replace().

source

pub unsafe fn remove_q_reg_exp( &self, rx: impl CastInto<Ref<QRegExp>> ) -> Ref<QString>

Removes every occurrence of the regular expression rx in the string, and returns a reference to the string. For example:

Calls C++ function: QString& QString::remove(const QRegExp& rx).

C++ documentation:

Removes every occurrence of the regular expression rx in the string, and returns a reference to the string. For example:


  QString r = "Telephone";
  r.remove(QRegExp("[aeiou]."));
  // r == "The"

See also indexOf(), lastIndexOf(), and replace().

source

pub unsafe fn remove_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> Ref<QString>

Removes every occurrence of the regular expression re in the string, and returns a reference to the string. For example:

Calls C++ function: QString& QString::remove(const QRegularExpression& re).

C++ documentation:

Removes every occurrence of the regular expression re in the string, and returns a reference to the string. For example:


  QString r = "Telephone";
  r.remove(QRegularExpression("[aeiou]."));
  // r == "The"

This function was introduced in Qt 5.0.

See also indexOf(), lastIndexOf(), and replace().

source

pub unsafe fn remove_q_char(&self, c: impl CastInto<Ref<QChar>>) -> Ref<QString>

Removes every occurrence of the character ch in this string, and returns a reference to this string.

Calls C++ function: QString& QString::remove(QChar c).

C++ documentation:

Removes every occurrence of the character ch in this string, and returns a reference to this string.

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

Example:

QString t = “Ali Baba”; t.remove(QChar(‘a’), Qt::CaseInsensitive); // t == “li Bb”

This is the same as replace(ch, "", cs).

See also replace().

source

pub unsafe fn remove_q_string( &self, s: impl CastInto<Ref<QString>> ) -> Ref<QString>

Removes every occurrence of the given str string in this string, and returns a reference to this string.

Calls C++ function: QString& QString::remove(const QString& s).

C++ documentation:

Removes every occurrence of the given str string in this string, and returns a reference to this string.

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

This is the same as replace(str, "", cs).

See also replace().

source

pub unsafe fn remove_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::remove(QLatin1String s, Qt::CaseSensitivity cs = …).

C++ documentation:

This is an overloaded function.

Removes every occurrence of the given str string in this string, and returns a reference to this string.

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

This is the same as replace(str, "", cs).

This function was introduced in Qt 5.11.

See also replace().

source

pub unsafe fn remove_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::remove(QLatin1String s).

C++ documentation:

This is an overloaded function.

Removes every occurrence of the given str string in this string, and returns a reference to this string.

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

This is the same as replace(str, "", cs).

This function was introduced in Qt 5.11.

See also replace().

source

pub unsafe fn repeated(&self, times: c_int) -> CppBox<QString>

Returns a copy of this string repeated the specified number of times.

Calls C++ function: QString QString::repeated(int times) const.

C++ documentation:

Returns a copy of this string repeated the specified number of times.

If times is less than 1, an empty string is returned.

Example:

QString str(“ab”); str.repeated(4); // returns “abababab”

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_2_int_q_char( &self, i: c_int, len: c_int, after: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(int i, int len, QChar after).

C++ documentation:

This function overloads replace().

Replaces n characters beginning at index position with the character after and returns a reference to this string.

source

pub unsafe fn replace_2_int_q_char_int( &self, i: c_int, len: c_int, s: impl CastInto<Ptr<QChar>>, slen: c_int ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(int i, int len, const QChar* s, int slen).

C++ documentation:

This function overloads replace().

Replaces n characters beginning at index position with the first size characters of the QChar array unicode and returns a reference to this string.

source

pub unsafe fn replace_2_int_q_string( &self, i: c_int, len: c_int, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

Replaces n characters beginning at index position with the string after and returns a reference to this string.

Calls C++ function: QString& QString::replace(int i, int len, const QString& after).

C++ documentation:

Replaces n characters beginning at index position with the string after and returns a reference to this string.

Note: If the specified position index is within the string, but position + n goes outside the strings range, then n will be adjusted to stop at the end of the string.

Example:

QString x = “Say yes!”; QString y = “no”; x.replace(4, 3, y); // x == “Say no!”

See also insert() and remove().

source

pub unsafe fn replace_2_q_char_case_sensitivity( &self, before: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character before with the character after and returns a reference to this string.

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

source

pub unsafe fn replace_q_char_int_q_char_int_case_sensitivity( &self, before: impl CastInto<Ptr<QChar>>, blen: c_int, after: impl CastInto<Ptr<QChar>>, alen: c_int, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QChar* before, int blen, const QChar* after, int alen, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces each occurrence in this string of the first blen characters of before with the first alen characters of after and returns a reference to this string.

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

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_2_q_latin1_string_case_sensitivity( &self, before: impl CastInto<Ref<QLatin1String>>, after: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_q_latin1_string_q_string_case_sensitivity( &self, before: impl CastInto<Ref<QLatin1String>>, after: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QLatin1String before, const QString& after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_q_string_q_latin1_string_case_sensitivity( &self, before: impl CastInto<Ref<QString>>, after: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QString& before, QLatin1String after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_2_q_string_case_sensitivity( &self, before: impl CastInto<Ref<QString>>, after: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QString& before, const QString& after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Example:

QString str = “colour behaviour flavour neighbour”; str.replace(QString(“ou”), QString(“o”)); // str == “color behavior flavor neighbor”

Note: The replacement text is not rescanned after it is inserted.

Example:

QString equis = “xxxxxx”; equis.replace(“xx”, “x”); // equis == “xxx”

source

pub unsafe fn replace_q_char_q_string_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar c, const QString& after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character ch in the string with after and returns a reference to this string.

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

source

pub unsafe fn replace_q_char_q_latin1_string_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs = …).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character c with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_q_reg_exp_q_string( &self, rx: impl CastInto<Ref<QRegExp>>, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QRegExp& rx, const QString& after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the regular expression rx in the string with after. Returns a reference to the string. For example:

QString s = “Banana”; s.replace(QRegExp(“a[mn]”), “ox”); // s == “Boxoxa”

For regular expressions containing capturing parentheses, occurrences of \1, \2, ..., in after are replaced with rx.cap(1), cap(2), ...

QString t = “A <i>bon mot</i>.”; t.replace(QRegExp(“<i>(1*)</i>”), “\emph{\1}”); // t == “A \emph{bon mot}.”

See also indexOf(), lastIndexOf(), remove(), and QRegExp::cap().


  1.  
source

pub unsafe fn replace_q_regular_expression_q_string( &self, re: impl CastInto<Ref<QRegularExpression>>, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QRegularExpression& re, const QString& after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the regular expression re in the string with after. Returns a reference to the string. For example:

QString s = “Banana”; s.replace(QRegularExpression(“a[mn]”), “ox”); // s == “Boxoxa”

For regular expressions containing capturing groups, occurrences of \1, \2, ..., in after are replaced with the string captured by the corresponding capturing group.

QString t = “A <i>bon mot</i>.”; t.replace(QRegularExpression(“<i>(1*)</i>”), “\emph{\1}”); // t == “A \emph{bon mot}.”

This function was introduced in Qt 5.0.

See also indexOf(), lastIndexOf(), remove(), QRegularExpression, and QRegularExpressionMatch.


  1.  
source

pub unsafe fn replace_2_q_char( &self, before: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QChar>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar before, QChar after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character before with the character after and returns a reference to this string.

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

source

pub unsafe fn replace_q_char_int_q_char_int( &self, before: impl CastInto<Ptr<QChar>>, blen: c_int, after: impl CastInto<Ptr<QChar>>, alen: c_int ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QChar* before, int blen, const QChar* after, int alen).

C++ documentation:

This function overloads replace().

Replaces each occurrence in this string of the first blen characters of before with the first alen characters of after and returns a reference to this string.

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

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_2_q_latin1_string( &self, before: impl CastInto<Ref<QLatin1String>>, after: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QLatin1String before, QLatin1String after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_q_latin1_string_q_string( &self, before: impl CastInto<Ref<QLatin1String>>, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QLatin1String before, const QString& after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_q_string_q_latin1_string( &self, before: impl CastInto<Ref<QString>>, after: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QString& before, QLatin1String after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn replace_2_q_string( &self, before: impl CastInto<Ref<QString>>, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(const QString& before, const QString& after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the string before with the string after and returns a reference to this string.

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

Example:

QString str = “colour behaviour flavour neighbour”; str.replace(QString(“ou”), QString(“o”)); // str == “color behavior flavor neighbor”

Note: The replacement text is not rescanned after it is inserted.

Example:

QString equis = “xxxxxx”; equis.replace(“xx”, “x”); // equis == “xxx”

source

pub unsafe fn replace_q_char_q_string( &self, c: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QString>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar c, const QString& after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character ch in the string with after and returns a reference to this string.

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

source

pub unsafe fn replace_q_char_q_latin1_string( &self, c: impl CastInto<Ref<QChar>>, after: impl CastInto<Ref<QLatin1String>> ) -> Ref<QString>

This function overloads replace().

Calls C++ function: QString& QString::replace(QChar c, QLatin1String after).

C++ documentation:

This function overloads replace().

Replaces every occurrence of the character c with the string after and returns a reference to this string.

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

Note: The text is not rescanned after a replacement.

This function was introduced in Qt 4.5.

source

pub unsafe fn reserve(&self, size: c_int)

Attempts to allocate memory for at least size characters. If you know in advance how large the string will be, you can call this function, and if you resize the string often you are likely to get better performance. If size is an underestimate, the worst that will happen is that the QString will be a bit slower.

Calls C++ function: void QString::reserve(int size).

C++ documentation:

Attempts to allocate memory for at least size characters. If you know in advance how large the string will be, you can call this function, and if you resize the string often you are likely to get better performance. If size is an underestimate, the worst that will happen is that the QString will be a bit slower.

The sole purpose of this function is to provide a means of fine tuning QString's memory usage. In general, you will rarely ever need to call this function. If you want to change the size of the string, call resize().

This function is useful for code that needs to build up a long string and wants to avoid repeated reallocation. In this example, we want to add to the string until some condition is true, and we're fairly sure that size is large enough to make a call to reserve() worthwhile:

QString result; int maxSize; bool condition; QChar nextChar;

result.reserve(maxSize);

while (condition) result.append(nextChar);

result.squeeze();

See also squeeze() and capacity().

source

pub unsafe fn resize_1a(&self, size: c_int)

Sets the size of the string to size characters.

Calls C++ function: void QString::resize(int size).

C++ documentation:

Sets the size of the string to size characters.

If size is greater than the current size, the string is extended to make it size characters long with the extra characters added to the end. The new characters are uninitialized.

If size is less than the current size, characters are removed from the end.

Example:

QString s = “Hello world”; s.resize(5); // s == “Hello”

s.resize(8); // s == “Hello???” (where ? stands for any character)

If you want to append a certain number of identical characters to the string, use the resize(int, QChar) overload.

If you want to expand the string so that it reaches a certain width and fill the new positions with a particular character, use the leftJustified() function:

If size is negative, it is equivalent to passing zero.

QString r = “Hello”; r = r.leftJustified(10, ’ ’); // r == “Hello “

See also truncate() and reserve().

source

pub unsafe fn resize_2a( &self, size: c_int, fill_char: impl CastInto<Ref<QChar>> )

This is an overloaded function.

Calls C++ function: void QString::resize(int size, QChar fillChar).

C++ documentation:

This is an overloaded function.

Unlike resize(int), this overload initializes the new characters to fillChar:

QString t = “Hello”; r.resize(t.size() + 10, ‘X’); // t == “HelloXXXXXXXXXX”

This function was introduced in Qt 5.7.

source

pub unsafe fn right(&self, n: c_int) -> CppBox<QString>

Returns a substring that contains the n rightmost characters of the string.

Calls C++ function: QString QString::right(int n) const.

C++ documentation:

Returns a substring that contains the n rightmost characters of the string.

The entire string is returned if n is greater than or equal to size(), or less than zero.

QString x = “Pineapple”; QString y = x.right(5); // y == “apple”

See also left(), mid(), and endsWith().

source

pub unsafe fn right_justified_3a( &self, width: c_int, fill: impl CastInto<Ref<QChar>>, trunc: bool ) -> CppBox<QString>

Returns a string of size() width that contains the fill character followed by the string. For example:

Calls C++ function: QString QString::rightJustified(int width, QChar fill = …, bool trunc = …) const.

C++ documentation:

Returns a string of size() width that contains the fill character followed by the string. For example:


  QString s = "apple";
  QString t = s.rightJustified(8, '.');    // t == "...apple"

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

If truncate is true and the size() of the string is more than width, then the resulting string is truncated at position width.

QString str = “Pineapple”; str = str.rightJustified(5, ‘.’, true); // str == “Pinea”

See also leftJustified().

source

pub unsafe fn right_justified_2a( &self, width: c_int, fill: impl CastInto<Ref<QChar>> ) -> CppBox<QString>

Returns a string of size() width that contains the fill character followed by the string. For example:

Calls C++ function: QString QString::rightJustified(int width, QChar fill = …) const.

C++ documentation:

Returns a string of size() width that contains the fill character followed by the string. For example:


  QString s = "apple";
  QString t = s.rightJustified(8, '.');    // t == "...apple"

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

If truncate is true and the size() of the string is more than width, then the resulting string is truncated at position width.

QString str = “Pineapple”; str = str.rightJustified(5, ‘.’, true); // str == “Pinea”

See also leftJustified().

source

pub unsafe fn right_justified_1a(&self, width: c_int) -> CppBox<QString>

Returns a string of size() width that contains the fill character followed by the string. For example:

Calls C++ function: QString QString::rightJustified(int width) const.

C++ documentation:

Returns a string of size() width that contains the fill character followed by the string. For example:


  QString s = "apple";
  QString t = s.rightJustified(8, '.');    // t == "...apple"

If truncate is false and the size() of the string is more than width, then the returned string is a copy of the string.

If truncate is true and the size() of the string is more than width, then the resulting string is truncated at position width.

QString str = “Pineapple”; str = str.rightJustified(5, ‘.’, true); // str == “Pinea”

See also leftJustified().

source

pub unsafe fn right_ref(&self, n: c_int) -> CppBox<QStringRef>

Returns a substring reference to the n rightmost characters of the string.

Calls C++ function: QStringRef QString::rightRef(int n) const.

C++ documentation:

Returns a substring reference to the n rightmost characters of the string.

If n is greater than or equal to size(), or less than zero, a reference to the entire string is returned.

QString x = “Pineapple”; QStringRef y = x.rightRef(5); // y == “apple”

This function was introduced in Qt 4.4.

See also right(), leftRef(), midRef(), and endsWith().

source

pub unsafe fn section_q_char2_int_q_flags_section_flag( &self, sep: impl CastInto<Ref<QChar>>, start: c_int, end: c_int, flags: QFlags<SectionFlag> ) -> CppBox<QString>

This function returns a section of the string.

Calls C++ function: QString QString::section(QChar sep, int start, int end = …, QFlags<QString::SectionFlag> flags = …) const.

C++ documentation:

This function returns a section of the string.

This string is treated as a sequence of fields separated by the character, sep. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left.

The flags argument can be used to affect some aspects of the function's behavior, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see SectionFlags.

QString str; QString csv = “forename,middlename,surname,phone”; QString path = “/usr/local/bin/myapp”; // First field is empty QString::SectionFlag flag = QString::SectionSkipEmpty;

str = csv.section(‘,’, 2, 2); // str == “surname” str = path.section(‘/’, 3, 4); // str == “bin/myapp” str = path.section(‘/’, 3, 3, flag); // str == “myapp”

If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.

str = csv.section(‘,’, -3, -2); // str == “middlename,surname” str = path.section(‘/’, -1); // str == “myapp”

See also split().

source

pub unsafe fn section_q_string2_int_q_flags_section_flag( &self, in_sep: impl CastInto<Ref<QString>>, start: c_int, end: c_int, flags: QFlags<SectionFlag> ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QString& in_sep, int start, int end = …, QFlags<QString::SectionFlag> flags = …) const.

C++ documentation:

This function overloads section().


  QString str;
  QString data = "forename**middlename**surname**phone";

  str = data.section("**", 2, 2); // str == "surname"
  str = data.section("**", -3, -2); // str == "middlename**surname"

See also split().

source

pub unsafe fn section_q_reg_exp2_int_q_flags_section_flag( &self, reg: impl CastInto<Ref<QRegExp>>, start: c_int, end: c_int, flags: QFlags<SectionFlag> ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegExp& reg, int start, int end = …, QFlags<QString::SectionFlag> flags = …) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, reg.

QString line = “forename\tmiddlename surname \t \t phone”; QRegExp sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegExp version is much more expensive than the overloaded string and character versions.

See also split() and simplified().

source

pub unsafe fn section_q_regular_expression2_int_q_flags_section_flag( &self, re: impl CastInto<Ref<QRegularExpression>>, start: c_int, end: c_int, flags: QFlags<SectionFlag> ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegularExpression& re, int start, int end = …, QFlags<QString::SectionFlag> flags = …) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, re.

QString line = “forename\tmiddlename surname \t \t phone”; QRegularExpression sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegularExpression version is much more expensive than the overloaded string and character versions.

This function was introduced in Qt 5.0.

See also split() and simplified().

source

pub unsafe fn section_q_char2_int( &self, sep: impl CastInto<Ref<QChar>>, start: c_int, end: c_int ) -> CppBox<QString>

This function returns a section of the string.

Calls C++ function: QString QString::section(QChar sep, int start, int end = …) const.

C++ documentation:

This function returns a section of the string.

This string is treated as a sequence of fields separated by the character, sep. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left.

The flags argument can be used to affect some aspects of the function's behavior, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see SectionFlags.

QString str; QString csv = “forename,middlename,surname,phone”; QString path = “/usr/local/bin/myapp”; // First field is empty QString::SectionFlag flag = QString::SectionSkipEmpty;

str = csv.section(‘,’, 2, 2); // str == “surname” str = path.section(‘/’, 3, 4); // str == “bin/myapp” str = path.section(‘/’, 3, 3, flag); // str == “myapp”

If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.

str = csv.section(‘,’, -3, -2); // str == “middlename,surname” str = path.section(‘/’, -1); // str == “myapp”

See also split().

source

pub unsafe fn section_q_char_int( &self, sep: impl CastInto<Ref<QChar>>, start: c_int ) -> CppBox<QString>

This function returns a section of the string.

Calls C++ function: QString QString::section(QChar sep, int start) const.

C++ documentation:

This function returns a section of the string.

This string is treated as a sequence of fields separated by the character, sep. The returned string consists of the fields from position start to position end inclusive. If end is not specified, all fields from position start to the end of the string are included. Fields are numbered 0, 1, 2, etc., counting from the left, and -1, -2, etc., counting from right to left.

The flags argument can be used to affect some aspects of the function's behavior, e.g. whether to be case sensitive, whether to skip empty fields and how to deal with leading and trailing separators; see SectionFlags.

QString str; QString csv = “forename,middlename,surname,phone”; QString path = “/usr/local/bin/myapp”; // First field is empty QString::SectionFlag flag = QString::SectionSkipEmpty;

str = csv.section(‘,’, 2, 2); // str == “surname” str = path.section(‘/’, 3, 4); // str == “bin/myapp” str = path.section(‘/’, 3, 3, flag); // str == “myapp”

If start or end is negative, we count fields from the right of the string, the right-most field being -1, the one from right-most field being -2, and so on.

str = csv.section(‘,’, -3, -2); // str == “middlename,surname” str = path.section(‘/’, -1); // str == “myapp”

See also split().

source

pub unsafe fn section_q_string2_int( &self, in_sep: impl CastInto<Ref<QString>>, start: c_int, end: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QString& in_sep, int start, int end = …) const.

C++ documentation:

This function overloads section().


  QString str;
  QString data = "forename**middlename**surname**phone";

  str = data.section("**", 2, 2); // str == "surname"
  str = data.section("**", -3, -2); // str == "middlename**surname"

See also split().

source

pub unsafe fn section_q_string_int( &self, in_sep: impl CastInto<Ref<QString>>, start: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QString& in_sep, int start) const.

C++ documentation:

This function overloads section().


  QString str;
  QString data = "forename**middlename**surname**phone";

  str = data.section("**", 2, 2); // str == "surname"
  str = data.section("**", -3, -2); // str == "middlename**surname"

See also split().

source

pub unsafe fn section_q_reg_exp2_int( &self, reg: impl CastInto<Ref<QRegExp>>, start: c_int, end: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegExp& reg, int start, int end = …) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, reg.

QString line = “forename\tmiddlename surname \t \t phone”; QRegExp sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegExp version is much more expensive than the overloaded string and character versions.

See also split() and simplified().

source

pub unsafe fn section_q_reg_exp_int( &self, reg: impl CastInto<Ref<QRegExp>>, start: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegExp& reg, int start) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, reg.

QString line = “forename\tmiddlename surname \t \t phone”; QRegExp sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegExp version is much more expensive than the overloaded string and character versions.

See also split() and simplified().

source

pub unsafe fn section_q_regular_expression2_int( &self, re: impl CastInto<Ref<QRegularExpression>>, start: c_int, end: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegularExpression& re, int start, int end = …) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, re.

QString line = “forename\tmiddlename surname \t \t phone”; QRegularExpression sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegularExpression version is much more expensive than the overloaded string and character versions.

This function was introduced in Qt 5.0.

See also split() and simplified().

source

pub unsafe fn section_q_regular_expression_int( &self, re: impl CastInto<Ref<QRegularExpression>>, start: c_int ) -> CppBox<QString>

This function overloads section().

Calls C++ function: QString QString::section(const QRegularExpression& re, int start) const.

C++ documentation:

This function overloads section().

This string is treated as a sequence of fields separated by the regular expression, re.

QString line = “forename\tmiddlename surname \t \t phone”; QRegularExpression sep(“\s+”); str = line.section(sep, 2, 2); // str == “surname” str = line.section(sep, -3, -2); // str == “middlename surname”

Warning: Using this QRegularExpression version is much more expensive than the overloaded string and character versions.

This function was introduced in Qt 5.0.

See also split() and simplified().

source

pub unsafe fn set_num_short_int( &self, arg1: c_short, base: c_int ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(short arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_ushort_int( &self, arg1: c_ushort, base: c_int ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned short arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_2_int(&self, arg1: c_int, base: c_int) -> Ref<QString>

Sets the string to the printed value of n in the specified base, and returns a reference to the string.

Calls C++ function: QString& QString::setNum(int arg1, int base = …).

C++ documentation:

Sets the string to the printed value of n in the specified base, and returns a reference to the string.

The base is 10 by default and must be between 2 and 36. For bases other than 10, n is treated as an unsigned integer.

QString str; str.setNum(1234); // str == “1234”

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_uint_int(&self, arg1: c_uint, base: c_int) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned int arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_long_int(&self, arg1: c_long, base: c_int) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(long arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_ulong_int( &self, arg1: c_ulong, base: c_int ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned long arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_i64_int(&self, arg1: i64, base: c_int) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(qlonglong arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_u64_int(&self, arg1: u64, base: c_int) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(qulonglong arg1, int base = …).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_float_char_int( &self, arg1: c_float, f: c_char, prec: c_int ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(float arg1, char f = …, int prec = …).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_double_char_int( &self, arg1: c_double, f: c_char, prec: c_int ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(double arg1, char f = …, int prec = …).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The format can be 'e', 'E', 'f', 'g' or 'G' (see Argument Formats for an explanation of the formats).

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_short(&self, arg1: c_short) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(short arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_ushort(&self, arg1: c_ushort) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned short arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_int(&self, arg1: c_int) -> Ref<QString>

Sets the string to the printed value of n in the specified base, and returns a reference to the string.

Calls C++ function: QString& QString::setNum(int arg1).

C++ documentation:

Sets the string to the printed value of n in the specified base, and returns a reference to the string.

The base is 10 by default and must be between 2 and 36. For bases other than 10, n is treated as an unsigned integer.

QString str; str.setNum(1234); // str == “1234”

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_uint(&self, arg1: c_uint) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned int arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_long(&self, arg1: c_long) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(long arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_ulong(&self, arg1: c_ulong) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(unsigned long arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_i64(&self, arg1: i64) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(qlonglong arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_u64(&self, arg1: u64) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(qulonglong arg1).

C++ documentation:

This is an overloaded function.

source

pub unsafe fn set_num_float_char( &self, arg1: c_float, f: c_char ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(float arg1, char f = …).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_float(&self, arg1: c_float) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(float arg1).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_double_char( &self, arg1: c_double, f: c_char ) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(double arg1, char f = …).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The format can be 'e', 'E', 'f', 'g' or 'G' (see Argument Formats for an explanation of the formats).

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_num_double(&self, arg1: c_double) -> Ref<QString>

This is an overloaded function.

Calls C++ function: QString& QString::setNum(double arg1).

C++ documentation:

This is an overloaded function.

Sets the string to the printed value of n, formatted according to the given format and precision, and returns a reference to the string.

The format can be 'e', 'E', 'f', 'g' or 'G' (see Argument Formats for an explanation of the formats).

The formatting always uses QLocale::C, i.e., English/UnitedStates. To get a localized string representation of a number, use QLocale::toString() with the appropriate locale.

source

pub unsafe fn set_raw_data( &self, unicode: impl CastInto<Ptr<QChar>>, size: c_int ) -> Ref<QString>

Resets the QString to use the first size Unicode characters in the array unicode. The data in unicode is not copied. The caller must be able to guarantee that unicode will not be deleted or modified as long as the QString (or an unmodified copy of it) exists.

Calls C++ function: QString& QString::setRawData(const QChar* unicode, int size).

C++ documentation:

Resets the QString to use the first size Unicode characters in the array unicode. The data in unicode is not copied. The caller must be able to guarantee that unicode will not be deleted or modified as long as the QString (or an unmodified copy of it) exists.

This function can be used instead of fromRawData() to re-use existings QString objects to save memory re-allocations.

This function was introduced in Qt 4.7.

See also fromRawData().

source

pub unsafe fn set_unicode( &self, unicode: impl CastInto<Ptr<QChar>>, size: c_int ) -> Ref<QString>

Resizes the string to size characters and copies unicode into the string.

Calls C++ function: QString& QString::setUnicode(const QChar* unicode, int size).

C++ documentation:

Resizes the string to size characters and copies unicode into the string.

If unicode is 0, nothing is copied, but the string is still resized to size.

See also unicode() and setUtf16().

source

pub unsafe fn set_utf16( &self, utf16: *const c_ushort, size: c_int ) -> Ref<QString>

Resizes the string to size characters and copies unicode into the string.

Calls C++ function: QString& QString::setUtf16(const unsigned short* utf16, int size).

C++ documentation:

Resizes the string to size characters and copies unicode into the string.

If unicode is 0, nothing is copied, but the string is still resized to size.

Note that unlike fromUtf16(), this function does not consider BOMs and possibly differing byte ordering.

See also utf16() and setUnicode().

source

pub unsafe fn shrink_to_fit(&self)

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This function is provided for STL compatibility. It is equivalent to squeeze().

Calls C++ function: void QString::shrink_to_fit().

C++ documentation:

This function is provided for STL compatibility. It is equivalent to squeeze().

This function was introduced in Qt 5.10.

See also squeeze().

source

pub unsafe fn simplified(&self) -> CppBox<QString>

Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.

Calls C++ function: QString QString::simplified() const.

C++ documentation:

Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.

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

Example:

QString str = “ lots\t of\nwhitespace\r\n “; str = str.simplified(); // str == “lots of whitespace”;

See also trimmed().

source

pub unsafe fn simplified_mut(&self) -> CppBox<QString>

Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.

Calls C++ function: QString QString::simplified().

C++ documentation:

Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.

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

Example:

QString str = “ lots\t of\nwhitespace\r\n “; str = str.simplified(); // str == “lots of whitespace”;

See also trimmed().

source

pub unsafe fn size(&self) -> c_int

Returns the number of characters in this string.

Calls C++ function: int QString::size() const.

C++ documentation:

Returns the number of characters in this string.

The last character in the string is at position size() - 1.

Example:

QString str = “World”; int n = str.size(); // n == 5 str.data()[0]; // returns ‘W’ str.data()[4]; // returns ‘d’

See also isEmpty() and resize().

source

pub unsafe fn split_q_string_split_behavior_case_sensitivity( &self, sep: impl CastInto<Ref<QString>>, behavior: SplitBehavior, cs: CaseSensitivity ) -> CppBox<QStringList>

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

Calls C++ function: QStringList QString::split(const QString& sep, QString::SplitBehavior behavior = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

cs specifies whether sep should be matched case sensitively or case insensitively.

If behavior is QString::SkipEmptyParts, empty entries don't appear in the result. By default, empty entries are kept.

Example:

QString str = “a,,b,c”;

QStringList list1 = str.split(‘,’); // list1: [ “a”, “”, “b”, “c” ]

QStringList list2 = str.split(‘,’, QString::SkipEmptyParts); // list2: [ “a”, “b”, “c” ]

If sep is empty, split() returns an empty string, followed by each of the string's characters, followed by another empty string:

QString str = “abc”; auto parts = str.split(“”); // parts: {“”, “a”, “b”, “c”, “”}

To understand this behavior, recall that the empty string matches everywhere, so the above is qualitatively the same as:

QString str = “/a/b/c/”; auto parts = str.split(‘/’); // parts: {“”, “a”, “b”, “c”, “”}

See also QStringList::join() and section().

source

pub unsafe fn split_q_char_split_behavior_case_sensitivity( &self, sep: impl CastInto<Ref<QChar>>, behavior: SplitBehavior, cs: CaseSensitivity ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(QChar sep, QString::SplitBehavior behavior = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn split_q_reg_exp_split_behavior( &self, sep: impl CastInto<Ref<QRegExp>>, behavior: SplitBehavior ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(const QRegExp& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

Splits the string into substrings wherever the regular expression rx matches, and returns the list of those strings. If rx does not match anywhere in the string, split() returns a single-element list containing this string.

Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:

QString str; QStringList list;

str = “Some text\n\twith strange whitespace.”; list = str.split(QRegExp(“\s+”)); // list: [ “Some”, “text”, “with”, “strange”, “whitespace.” ]

Here's a similar example, but this time we use any sequence of non-word characters as the separator:

str = “This time, a normal English sentence.”; list = str.split(QRegExp(“\W+”), QString::SkipEmptyParts); // list: [ “This”, “time”, “a”, “normal”, “English”, “sentence” ]

Here's a third example where we use a zero-length assertion, \b (word boundary), to split the string into an alternating sequence of non-word and word tokens:

str = “Now: this sentence fragment.”; list = str.split(QRegExp(“\b”)); // list: [ “”, “Now”, “: “, “this”, “ “, “sentence”, “ “, “fragment”, “.” ]

See also QStringList::join() and section().

source

pub unsafe fn split_q_regular_expression_split_behavior( &self, sep: impl CastInto<Ref<QRegularExpression>>, behavior: SplitBehavior ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(const QRegularExpression& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

Splits the string into substrings wherever the regular expression re matches, and returns the list of those strings. If re does not match anywhere in the string, split() returns a single-element list containing this string.

Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:

QString str; QStringList list;

str = “Some text\n\twith strange whitespace.”; list = str.split(QRegularExpression(“\s+”)); // list: [ “Some”, “text”, “with”, “strange”, “whitespace.” ]

Here's a similar example, but this time we use any sequence of non-word characters as the separator:

str = “This time, a normal English sentence.”; list = str.split(QRegularExpression(“\W+”), QString::SkipEmptyParts); // list: [ “This”, “time”, “a”, “normal”, “English”, “sentence” ]

Here's a third example where we use a zero-length assertion, \b (word boundary), to split the string into an alternating sequence of non-word and word tokens:

str = “Now: this sentence fragment.”; list = str.split(QRegularExpression(“\b”)); // list: [ “”, “Now”, “: “, “this”, “ “, “sentence”, “ “, “fragment”, “.” ]

This function was introduced in Qt 5.0.

See also QStringList::join() and section().

source

pub unsafe fn split_q_string_split_behavior( &self, sep: impl CastInto<Ref<QString>>, behavior: SplitBehavior ) -> CppBox<QStringList>

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

Calls C++ function: QStringList QString::split(const QString& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

cs specifies whether sep should be matched case sensitively or case insensitively.

If behavior is QString::SkipEmptyParts, empty entries don't appear in the result. By default, empty entries are kept.

Example:

QString str = “a,,b,c”;

QStringList list1 = str.split(‘,’); // list1: [ “a”, “”, “b”, “c” ]

QStringList list2 = str.split(‘,’, QString::SkipEmptyParts); // list2: [ “a”, “b”, “c” ]

If sep is empty, split() returns an empty string, followed by each of the string's characters, followed by another empty string:

QString str = “abc”; auto parts = str.split(“”); // parts: {“”, “a”, “b”, “c”, “”}

To understand this behavior, recall that the empty string matches everywhere, so the above is qualitatively the same as:

QString str = “/a/b/c/”; auto parts = str.split(‘/’); // parts: {“”, “a”, “b”, “c”, “”}

See also QStringList::join() and section().

source

pub unsafe fn split_q_string( &self, sep: impl CastInto<Ref<QString>> ) -> CppBox<QStringList>

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

Calls C++ function: QStringList QString::split(const QString& sep) const.

C++ documentation:

Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.

cs specifies whether sep should be matched case sensitively or case insensitively.

If behavior is QString::SkipEmptyParts, empty entries don't appear in the result. By default, empty entries are kept.

Example:

QString str = “a,,b,c”;

QStringList list1 = str.split(‘,’); // list1: [ “a”, “”, “b”, “c” ]

QStringList list2 = str.split(‘,’, QString::SkipEmptyParts); // list2: [ “a”, “b”, “c” ]

If sep is empty, split() returns an empty string, followed by each of the string's characters, followed by another empty string:

QString str = “abc”; auto parts = str.split(“”); // parts: {“”, “a”, “b”, “c”, “”}

To understand this behavior, recall that the empty string matches everywhere, so the above is qualitatively the same as:

QString str = “/a/b/c/”; auto parts = str.split(‘/’); // parts: {“”, “a”, “b”, “c”, “”}

See also QStringList::join() and section().

source

pub unsafe fn split_q_char_split_behavior( &self, sep: impl CastInto<Ref<QChar>>, behavior: SplitBehavior ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(QChar sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn split_q_char( &self, sep: impl CastInto<Ref<QChar>> ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(QChar sep) const.

C++ documentation:

This is an overloaded function.

source

pub unsafe fn split_q_reg_exp( &self, sep: impl CastInto<Ref<QRegExp>> ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(const QRegExp& sep) const.

C++ documentation:

This is an overloaded function.

Splits the string into substrings wherever the regular expression rx matches, and returns the list of those strings. If rx does not match anywhere in the string, split() returns a single-element list containing this string.

Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:

QString str; QStringList list;

str = “Some text\n\twith strange whitespace.”; list = str.split(QRegExp(“\s+”)); // list: [ “Some”, “text”, “with”, “strange”, “whitespace.” ]

Here's a similar example, but this time we use any sequence of non-word characters as the separator:

str = “This time, a normal English sentence.”; list = str.split(QRegExp(“\W+”), QString::SkipEmptyParts); // list: [ “This”, “time”, “a”, “normal”, “English”, “sentence” ]

Here's a third example where we use a zero-length assertion, \b (word boundary), to split the string into an alternating sequence of non-word and word tokens:

str = “Now: this sentence fragment.”; list = str.split(QRegExp(“\b”)); // list: [ “”, “Now”, “: “, “this”, “ “, “sentence”, “ “, “fragment”, “.” ]

See also QStringList::join() and section().

source

pub unsafe fn split_q_regular_expression( &self, sep: impl CastInto<Ref<QRegularExpression>> ) -> CppBox<QStringList>

This is an overloaded function.

Calls C++ function: QStringList QString::split(const QRegularExpression& sep) const.

C++ documentation:

This is an overloaded function.

Splits the string into substrings wherever the regular expression re matches, and returns the list of those strings. If re does not match anywhere in the string, split() returns a single-element list containing this string.

Here's an example where we extract the words in a sentence using one or more whitespace characters as the separator:

QString str; QStringList list;

str = “Some text\n\twith strange whitespace.”; list = str.split(QRegularExpression(“\s+”)); // list: [ “Some”, “text”, “with”, “strange”, “whitespace.” ]

Here's a similar example, but this time we use any sequence of non-word characters as the separator:

str = “This time, a normal English sentence.”; list = str.split(QRegularExpression(“\W+”), QString::SkipEmptyParts); // list: [ “This”, “time”, “a”, “normal”, “English”, “sentence” ]

Here's a third example where we use a zero-length assertion, \b (word boundary), to split the string into an alternating sequence of non-word and word tokens:

str = “Now: this sentence fragment.”; list = str.split(QRegularExpression(“\b”)); // list: [ “”, “Now”, “: “, “this”, “ “, “sentence”, “ “, “fragment”, “.” ]

This function was introduced in Qt 5.0.

See also QStringList::join() and section().

source

pub unsafe fn split_q_string_q_flags_split_behavior_flags_case_sensitivity( &self, sep: impl CastInto<Ref<QString>>, behavior: QFlags<SplitBehaviorFlags>, cs: CaseSensitivity ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(const QString& sep, QFlags<Qt::SplitBehaviorFlags> behavior, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn split_q_char_q_flags_split_behavior_flags_case_sensitivity( &self, sep: impl CastInto<Ref<QChar>>, behavior: QFlags<SplitBehaviorFlags>, cs: CaseSensitivity ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(QChar sep, QFlags<Qt::SplitBehaviorFlags> behavior, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn split_q_reg_exp_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QRegExp>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(const QRegExp& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_q_regular_expression_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QRegularExpression>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(const QRegularExpression& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_q_string_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QString>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(const QString& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_q_char_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QChar>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QStringList>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QStringList QString::split(QChar sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_ref_q_string_split_behavior_case_sensitivity( &self, sep: impl CastInto<Ref<QString>>, behavior: SplitBehavior, cs: CaseSensitivity ) -> CppBox<QVectorOfQStringRef>

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QString& sep, QString::SplitBehavior behavior = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

See QString::split() for how sep, behavior and cs interact to form the result.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also QStringRef and split().

source

pub unsafe fn split_ref_q_char_split_behavior_case_sensitivity( &self, sep: impl CastInto<Ref<QChar>>, behavior: SplitBehavior, cs: CaseSensitivity ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(QChar sep, QString::SplitBehavior behavior = …, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.4.

source

pub unsafe fn split_ref_q_reg_exp_split_behavior( &self, sep: impl CastInto<Ref<QRegExp>>, behavior: SplitBehavior ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegExp& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

Splits the string into substring references wherever the regular expression rx matches, and returns the list of those strings. If rx does not match anywhere in the string, splitRef() returns a single-element vector containing this string reference.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also QStringRef and split().

source

pub unsafe fn split_ref_q_regular_expression_split_behavior( &self, sep: impl CastInto<Ref<QRegularExpression>>, behavior: SplitBehavior ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegularExpression& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

Splits the string into substring references wherever the regular expression re matches, and returns the list of those strings. If re does not match anywhere in the string, splitRef() returns a single-element vector containing this string reference.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also split() and QStringRef.

source

pub unsafe fn split_ref_q_string_split_behavior( &self, sep: impl CastInto<Ref<QString>>, behavior: SplitBehavior ) -> CppBox<QVectorOfQStringRef>

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QString& sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

See QString::split() for how sep, behavior and cs interact to form the result.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also QStringRef and split().

source

pub unsafe fn split_ref_q_string( &self, sep: impl CastInto<Ref<QString>> ) -> CppBox<QVectorOfQStringRef>

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QString& sep) const.

C++ documentation:

Splits the string into substring references wherever sep occurs, and returns the list of those strings.

See QString::split() for how sep, behavior and cs interact to form the result.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also QStringRef and split().

source

pub unsafe fn split_ref_q_char_split_behavior( &self, sep: impl CastInto<Ref<QChar>>, behavior: SplitBehavior ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(QChar sep, QString::SplitBehavior behavior = …) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.4.

source

pub unsafe fn split_ref_q_char( &self, sep: impl CastInto<Ref<QChar>> ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(QChar sep) const.

C++ documentation:

This is an overloaded function.

This function was introduced in Qt 5.4.

source

pub unsafe fn split_ref_q_reg_exp( &self, sep: impl CastInto<Ref<QRegExp>> ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegExp& sep) const.

C++ documentation:

This is an overloaded function.

Splits the string into substring references wherever the regular expression rx matches, and returns the list of those strings. If rx does not match anywhere in the string, splitRef() returns a single-element vector containing this string reference.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also QStringRef and split().

source

pub unsafe fn split_ref_q_regular_expression( &self, sep: impl CastInto<Ref<QRegularExpression>> ) -> CppBox<QVectorOfQStringRef>

This is an overloaded function.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegularExpression& sep) const.

C++ documentation:

This is an overloaded function.

Splits the string into substring references wherever the regular expression re matches, and returns the list of those strings. If re does not match anywhere in the string, splitRef() returns a single-element vector containing this string reference.

Note: All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers.

This function was introduced in Qt 5.4.

See also split() and QStringRef.

source

pub unsafe fn split_ref_q_string_q_flags_split_behavior_flags_case_sensitivity( &self, sep: impl CastInto<Ref<QString>>, behavior: QFlags<SplitBehaviorFlags>, cs: CaseSensitivity ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QString& sep, QFlags<Qt::SplitBehaviorFlags> behavior, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn split_ref_q_char_q_flags_split_behavior_flags_case_sensitivity( &self, sep: impl CastInto<Ref<QChar>>, behavior: QFlags<SplitBehaviorFlags>, cs: CaseSensitivity ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(QChar sep, QFlags<Qt::SplitBehaviorFlags> behavior, Qt::CaseSensitivity cs = …) const.

source

pub unsafe fn split_ref_q_reg_exp_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QRegExp>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegExp& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_ref_q_regular_expression_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QRegularExpression>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QRegularExpression& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_ref_q_string_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QString>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(const QString& sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn split_ref_q_char_q_flags_split_behavior_flags( &self, sep: impl CastInto<Ref<QChar>>, behavior: QFlags<SplitBehaviorFlags> ) -> CppBox<QVectorOfQStringRef>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QVector<QStringRef> QString::splitRef(QChar sep, QFlags<Qt::SplitBehaviorFlags> behavior) const.

source

pub unsafe fn squeeze(&self)

Releases any memory not required to store the character data.

Calls C++ function: void QString::squeeze().

C++ documentation:

Releases any memory not required to store the character data.

The sole purpose of this function is to provide a means of fine tuning QString's memory usage. In general, you will rarely ever need to call this function.

See also reserve() and capacity().

source

pub unsafe fn starts_with_q_string_case_sensitivity( &self, s: impl CastInto<Ref<QString>>, cs: CaseSensitivity ) -> bool

Returns true if the string starts with s; otherwise returns false.

Calls C++ function: bool QString::startsWith(const QString& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

Returns true if the string starts with s; otherwise returns false.

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

QString str = “Bananas”; str.startsWith(“Ban”); // returns true str.startsWith(“Car”); // returns false

See also endsWith().

source

pub unsafe fn starts_with_q_string_ref_case_sensitivity( &self, s: impl CastInto<Ref<QStringRef>>, cs: CaseSensitivity ) -> bool

This is an overloaded function.

Calls C++ function: bool QString::startsWith(const QStringRef& s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This is an overloaded function.

Returns true if the string starts with the string reference s; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also endsWith().

source

pub unsafe fn starts_with_q_latin1_string_case_sensitivity( &self, s: impl CastInto<Ref<QLatin1String>>, cs: CaseSensitivity ) -> bool

This function overloads startsWith().

Calls C++ function: bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads startsWith().

source

pub unsafe fn starts_with_q_char_case_sensitivity( &self, c: impl CastInto<Ref<QChar>>, cs: CaseSensitivity ) -> bool

This function overloads startsWith().

Calls C++ function: bool QString::startsWith(QChar c, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This function overloads startsWith().

Returns true if the string starts with c; otherwise returns false.

source

pub unsafe fn starts_with_q_string( &self, s: impl CastInto<Ref<QString>> ) -> bool

Returns true if the string starts with s; otherwise returns false.

Calls C++ function: bool QString::startsWith(const QString& s) const.

C++ documentation:

Returns true if the string starts with s; otherwise returns false.

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

QString str = “Bananas”; str.startsWith(“Ban”); // returns true str.startsWith(“Car”); // returns false

See also endsWith().

source

pub unsafe fn starts_with_q_string_ref( &self, s: impl CastInto<Ref<QStringRef>> ) -> bool

This is an overloaded function.

Calls C++ function: bool QString::startsWith(const QStringRef& s) const.

C++ documentation:

This is an overloaded function.

Returns true if the string starts with the string reference s; otherwise returns false.

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

This function was introduced in Qt 4.8.

See also endsWith().

source

pub unsafe fn starts_with_q_latin1_string( &self, s: impl CastInto<Ref<QLatin1String>> ) -> bool

This function overloads startsWith().

Calls C++ function: bool QString::startsWith(QLatin1String s) const.

C++ documentation:

This function overloads startsWith().

source

pub unsafe fn starts_with_q_char(&self, c: impl CastInto<Ref<QChar>>) -> bool

This function overloads startsWith().

Calls C++ function: bool QString::startsWith(QChar c) const.

C++ documentation:

This function overloads startsWith().

Returns true if the string starts with c; otherwise returns false.

source

pub unsafe fn starts_with_q_string_view_case_sensitivity( &self, s: impl CastInto<Ref<QStringView>>, cs: CaseSensitivity ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: bool QString::startsWith(QStringView s, Qt::CaseSensitivity cs = …) const.

C++ documentation:

This is an overloaded function.

Returns true if the string starts with the string-view str; otherwise returns false.

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

This function was introduced in Qt 5.10.

See also endsWith().

source

pub unsafe fn starts_with_q_string_view( &self, s: impl CastInto<Ref<QStringView>> ) -> bool

Available on cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

This is an overloaded function.

Calls C++ function: bool QString::startsWith(QStringView s) const.

C++ documentation:

This is an overloaded function.

Returns true if the string starts with the string-view str; otherwise returns false.

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

This function was introduced in Qt 5.10.

See also endsWith().

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QString>>)

Swaps string other with this string. This operation is very fast and never fails.

Calls C++ function: void QString::swap(QString& other).

C++ documentation:

Swaps string other with this string. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

source

pub unsafe fn to_case_folded(&self) -> CppBox<QString>

Returns the case folded equivalent of the string. For most Unicode characters this is the same as toLower().

Calls C++ function: QString QString::toCaseFolded() const.

C++ documentation:

Returns the case folded equivalent of the string. For most Unicode characters this is the same as toLower().

source

pub unsafe fn to_case_folded_mut(&self) -> CppBox<QString>

Returns the case folded equivalent of the string. For most Unicode characters this is the same as toLower().

Calls C++ function: QString QString::toCaseFolded().

C++ documentation:

Returns the case folded equivalent of the string. For most Unicode characters this is the same as toLower().

source

pub unsafe fn to_double_1a(&self, ok: *mut bool) -> c_double

Returns the string converted to a double value.

Calls C++ function: double QString::toDouble(bool* ok = …) const.

C++ documentation:

Returns the string converted to a double value.

Returns 0.0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

QString str = “1234.56”; double val = str.toDouble(); // val == 1234.56

Warning: The QString content may only contain valid numerical characters which includes the plus/minus sign, the characters g and e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error.

bool ok; double d;

d = QString( “1234.56e-02” ).toDouble(&ok); // ok == true, d == 12.3456

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble()

d = QString( “1234,56” ).toDouble(&ok); // ok == false d = QString( “1234.56” ).toDouble(&ok); // ok == true, d == 1234.56

For historical reasons, this function does not handle thousands group separators. If you need to convert such numbers, use QLocale::toDouble().

d = QString( “1,234,567.89” ).toDouble(&ok); // ok == false d = QString( “1234567.89” ).toDouble(&ok); // ok == true

See also number(), QLocale::setDefault(), QLocale::toDouble(), and trimmed().

source

pub unsafe fn to_double_0a(&self) -> c_double

Returns the string converted to a double value.

Calls C++ function: double QString::toDouble() const.

C++ documentation:

Returns the string converted to a double value.

Returns 0.0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

QString str = “1234.56”; double val = str.toDouble(); // val == 1234.56

Warning: The QString content may only contain valid numerical characters which includes the plus/minus sign, the characters g and e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error.

bool ok; double d;

d = QString( “1234.56e-02” ).toDouble(&ok); // ok == true, d == 12.3456

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble()

d = QString( “1234,56” ).toDouble(&ok); // ok == false d = QString( “1234.56” ).toDouble(&ok); // ok == true, d == 1234.56

For historical reasons, this function does not handle thousands group separators. If you need to convert such numbers, use QLocale::toDouble().

d = QString( “1,234,567.89” ).toDouble(&ok); // ok == false d = QString( “1234567.89” ).toDouble(&ok); // ok == true

See also number(), QLocale::setDefault(), QLocale::toDouble(), and trimmed().

source

pub unsafe fn to_float_1a(&self, ok: *mut bool) -> c_float

Returns the string converted to a float value.

Calls C++ function: float QString::toFloat(bool* ok = …) const.

C++ documentation:

Returns the string converted to a float value.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true. Returns 0.0 if the conversion fails.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat()

Example:

QString str1 = “1234.56”; str1.toFloat(); // returns 1234.56

bool ok; QString str2 = “R2D2”; str2.toFloat(&ok); // returns 0.0, sets ok to false

See also number(), toDouble(), toInt(), and QLocale::toFloat().

source

pub unsafe fn to_float_0a(&self) -> c_float

Returns the string converted to a float value.

Calls C++ function: float QString::toFloat() const.

C++ documentation:

Returns the string converted to a float value.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true. Returns 0.0 if the conversion fails.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat()

Example:

QString str1 = “1234.56”; str1.toFloat(); // returns 1234.56

bool ok; QString str2 = “R2D2”; str2.toFloat(&ok); // returns 0.0, sets ok to false

See also number(), toDouble(), toInt(), and QLocale::toFloat().

source

pub unsafe fn to_html_escaped(&self) -> CppBox<QString>

Converts a plain text string to an HTML string with HTML metacharacters <, >, &, and " replaced by HTML entities.

Calls C++ function: QString QString::toHtmlEscaped() const.

C++ documentation:

Converts a plain text string to an HTML string with HTML metacharacters <, >, &, and replaced by HTML entities.

Example:

QString plain = “#include <QtCore>” QString html = plain.toHtmlEscaped(); // html == “#include &lt;QtCore&gt;”

This function was introduced in Qt 5.0.

source

pub unsafe fn to_int_2a(&self, ok: *mut bool, base: c_int) -> c_int

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: int QString::toInt(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toInt()

Example:

QString str = “FF”; bool ok; int hex = str.toInt(&ok, 16); // hex == 255, ok == true int dec = str.toInt(&ok, 10); // dec == 0, ok == false

See also number(), toUInt(), toDouble(), and QLocale::toInt().

source

pub unsafe fn to_int_1a(&self, ok: *mut bool) -> c_int

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: int QString::toInt(bool* ok = …) const.

C++ documentation:

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toInt()

Example:

QString str = “FF”; bool ok; int hex = str.toInt(&ok, 16); // hex == 255, ok == true int dec = str.toInt(&ok, 10); // dec == 0, ok == false

See also number(), toUInt(), toDouble(), and QLocale::toInt().

source

pub unsafe fn to_int_0a(&self) -> c_int

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: int QString::toInt() const.

C++ documentation:

Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toInt()

Example:

QString str = “FF”; bool ok; int hex = str.toInt(&ok, 16); // hex == 255, ok == true int dec = str.toInt(&ok, 10); // dec == 0, ok == false

See also number(), toUInt(), toDouble(), and QLocale::toInt().

source

pub unsafe fn to_latin1(&self) -> CppBox<QByteArray>

Returns a Latin-1 representation of the string as a QByteArray.

Calls C++ function: QByteArray QString::toLatin1() const.

C++ documentation:

Returns a Latin-1 representation of the string as a QByteArray.

The returned byte array is undefined if the string contains non-Latin1 characters. Those characters may be suppressed or replaced with a question mark.

See also fromLatin1(), toUtf8(), toLocal8Bit(), and QTextCodec.

source

pub unsafe fn to_latin1_mut(&self) -> CppBox<QByteArray>

Returns a Latin-1 representation of the string as a QByteArray.

Calls C++ function: QByteArray QString::toLatin1().

C++ documentation:

Returns a Latin-1 representation of the string as a QByteArray.

The returned byte array is undefined if the string contains non-Latin1 characters. Those characters may be suppressed or replaced with a question mark.

See also fromLatin1(), toUtf8(), toLocal8Bit(), and QTextCodec.

source

pub unsafe fn to_local8_bit(&self) -> CppBox<QByteArray>

Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.

Calls C++ function: QByteArray QString::toLocal8Bit() const.

C++ documentation:

Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.

QTextCodec::codecForLocale() is used to perform the conversion from Unicode. If the locale encoding could not be determined, this function does the same as toLatin1().

If this string contains any characters that cannot be encoded in the locale, the returned byte array is undefined. Those characters may be suppressed or replaced by another.

See also fromLocal8Bit(), toLatin1(), toUtf8(), and QTextCodec.

source

pub unsafe fn to_local8_bit_mut(&self) -> CppBox<QByteArray>

Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.

Calls C++ function: QByteArray QString::toLocal8Bit().

C++ documentation:

Returns the local 8-bit representation of the string as a QByteArray. The returned byte array is undefined if the string contains characters not supported by the local 8-bit encoding.

QTextCodec::codecForLocale() is used to perform the conversion from Unicode. If the locale encoding could not be determined, this function does the same as toLatin1().

If this string contains any characters that cannot be encoded in the locale, the returned byte array is undefined. Those characters may be suppressed or replaced by another.

See also fromLocal8Bit(), toLatin1(), toUtf8(), and QTextCodec.

source

pub unsafe fn to_long_2a(&self, ok: *mut bool, base: c_int) -> c_long

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: long QString::toLong(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

long hex = str.toLong(&ok, 16); // hex == 255, ok == true long dec = str.toLong(&ok, 10); // dec == 0, ok == false

See also number(), toULong(), toInt(), and QLocale::toInt().

source

pub unsafe fn to_long_1a(&self, ok: *mut bool) -> c_long

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: long QString::toLong(bool* ok = …) const.

C++ documentation:

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

long hex = str.toLong(&ok, 16); // hex == 255, ok == true long dec = str.toLong(&ok, 10); // dec == 0, ok == false

See also number(), toULong(), toInt(), and QLocale::toInt().

source

pub unsafe fn to_long_0a(&self) -> c_long

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: long QString::toLong() const.

C++ documentation:

Returns the string converted to a long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

long hex = str.toLong(&ok, 16); // hex == 255, ok == true long dec = str.toLong(&ok, 10); // dec == 0, ok == false

See also number(), toULong(), toInt(), and QLocale::toInt().

source

pub unsafe fn to_long_long_2a(&self, ok: *mut bool, base: c_int) -> i64

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qlonglong QString::toLongLong(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

qint64 hex = str.toLongLong(&ok, 16); // hex == 255, ok == true qint64 dec = str.toLongLong(&ok, 10); // dec == 0, ok == false

See also number(), toULongLong(), toInt(), and QLocale::toLongLong().

source

pub unsafe fn to_long_long_1a(&self, ok: *mut bool) -> i64

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qlonglong QString::toLongLong(bool* ok = …) const.

C++ documentation:

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

qint64 hex = str.toLongLong(&ok, 16); // hex == 255, ok == true qint64 dec = str.toLongLong(&ok, 10); // dec == 0, ok == false

See also number(), toULongLong(), toInt(), and QLocale::toLongLong().

source

pub unsafe fn to_long_long_0a(&self) -> i64

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qlonglong QString::toLongLong() const.

C++ documentation:

Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toLongLong()

Example:

QString str = “FF”; bool ok;

qint64 hex = str.toLongLong(&ok, 16); // hex == 255, ok == true qint64 dec = str.toLongLong(&ok, 10); // dec == 0, ok == false

See also number(), toULongLong(), toInt(), and QLocale::toLongLong().

source

pub unsafe fn to_lower(&self) -> CppBox<QString>

Returns a lowercase copy of the string.

Calls C++ function: QString QString::toLower() const.

C++ documentation:

Returns a lowercase copy of the string.


  QString str = "The Qt PROJECT";
  str = str.toLower();        // str == "the qt project"

The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toLower()

See also toUpper() and QLocale::toLower().

source

pub unsafe fn to_lower_mut(&self) -> CppBox<QString>

Returns a lowercase copy of the string.

Calls C++ function: QString QString::toLower().

C++ documentation:

Returns a lowercase copy of the string.


  QString str = "The Qt PROJECT";
  str = str.toLower();        // str == "the qt project"

The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toLower()

See also toUpper() and QLocale::toLower().

source

pub unsafe fn to_short_2a(&self, ok: *mut bool, base: c_int) -> c_short

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: short QString::toShort(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toShort()

Example:

QString str = “FF”; bool ok;

short hex = str.toShort(&ok, 16); // hex == 255, ok == true short dec = str.toShort(&ok, 10); // dec == 0, ok == false

See also number(), toUShort(), toInt(), and QLocale::toShort().

source

pub unsafe fn to_short_1a(&self, ok: *mut bool) -> c_short

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: short QString::toShort(bool* ok = …) const.

C++ documentation:

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toShort()

Example:

QString str = “FF”; bool ok;

short hex = str.toShort(&ok, 16); // hex == 255, ok == true short dec = str.toShort(&ok, 10); // dec == 0, ok == false

See also number(), toUShort(), toInt(), and QLocale::toShort().

source

pub unsafe fn to_short_0a(&self) -> c_short

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: short QString::toShort() const.

C++ documentation:

Returns the string converted to a short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toShort()

Example:

QString str = “FF”; bool ok;

short hex = str.toShort(&ok, 16); // hex == 255, ok == true short dec = str.toShort(&ok, 10); // dec == 0, ok == false

See also number(), toUShort(), toInt(), and QLocale::toShort().

source

pub unsafe fn to_u_int_2a(&self, ok: *mut bool, base: c_int) -> c_uint

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned int QString::toUInt(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUInt()

Example:

QString str = “FF”; bool ok;

uint hex = str.toUInt(&ok, 16); // hex == 255, ok == true uint dec = str.toUInt(&ok, 10); // dec == 0, ok == false

See also number(), toInt(), and QLocale::toUInt().

source

pub unsafe fn to_u_int_1a(&self, ok: *mut bool) -> c_uint

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned int QString::toUInt(bool* ok = …) const.

C++ documentation:

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUInt()

Example:

QString str = “FF”; bool ok;

uint hex = str.toUInt(&ok, 16); // hex == 255, ok == true uint dec = str.toUInt(&ok, 10); // dec == 0, ok == false

See also number(), toInt(), and QLocale::toUInt().

source

pub unsafe fn to_u_int_0a(&self) -> c_uint

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned int QString::toUInt() const.

C++ documentation:

Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUInt()

Example:

QString str = “FF”; bool ok;

uint hex = str.toUInt(&ok, 16); // hex == 255, ok == true uint dec = str.toUInt(&ok, 10); // dec == 0, ok == false

See also number(), toInt(), and QLocale::toUInt().

source

pub unsafe fn to_u_long_2a(&self, ok: *mut bool, base: c_int) -> c_ulong

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned long QString::toULong(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

ulong hex = str.toULong(&ok, 16); // hex == 255, ok == true ulong dec = str.toULong(&ok, 10); // dec == 0, ok == false

See also number() and QLocale::toUInt().

source

pub unsafe fn to_u_long_1a(&self, ok: *mut bool) -> c_ulong

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned long QString::toULong(bool* ok = …) const.

C++ documentation:

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

ulong hex = str.toULong(&ok, 16); // hex == 255, ok == true ulong dec = str.toULong(&ok, 10); // dec == 0, ok == false

See also number() and QLocale::toUInt().

source

pub unsafe fn to_u_long_0a(&self) -> c_ulong

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned long QString::toULong() const.

C++ documentation:

Returns the string converted to an unsigned long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

ulong hex = str.toULong(&ok, 16); // hex == 255, ok == true ulong dec = str.toULong(&ok, 10); // dec == 0, ok == false

See also number() and QLocale::toUInt().

source

pub unsafe fn to_u_long_long_2a(&self, ok: *mut bool, base: c_int) -> u64

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qulonglong QString::toULongLong(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

quint64 hex = str.toULongLong(&ok, 16); // hex == 255, ok == true quint64 dec = str.toULongLong(&ok, 10); // dec == 0, ok == false

See also number(), toLongLong(), and QLocale::toULongLong().

source

pub unsafe fn to_u_long_long_1a(&self, ok: *mut bool) -> u64

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qulonglong QString::toULongLong(bool* ok = …) const.

C++ documentation:

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

quint64 hex = str.toULongLong(&ok, 16); // hex == 255, ok == true quint64 dec = str.toULongLong(&ok, 10); // dec == 0, ok == false

See also number(), toLongLong(), and QLocale::toULongLong().

source

pub unsafe fn to_u_long_long_0a(&self) -> u64

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: qulonglong QString::toULongLong() const.

C++ documentation:

Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toULongLong()

Example:

QString str = “FF”; bool ok;

quint64 hex = str.toULongLong(&ok, 16); // hex == 255, ok == true quint64 dec = str.toULongLong(&ok, 10); // dec == 0, ok == false

See also number(), toLongLong(), and QLocale::toULongLong().

source

pub unsafe fn to_u_short_2a(&self, ok: *mut bool, base: c_int) -> c_ushort

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned short QString::toUShort(bool* ok = …, int base = …) const.

C++ documentation:

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUShort()

Example:

QString str = “FF”; bool ok;

ushort hex = str.toUShort(&ok, 16); // hex == 255, ok == true ushort dec = str.toUShort(&ok, 10); // dec == 0, ok == false

See also number(), toShort(), and QLocale::toUShort().

source

pub unsafe fn to_u_short_1a(&self, ok: *mut bool) -> c_ushort

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned short QString::toUShort(bool* ok = …) const.

C++ documentation:

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUShort()

Example:

QString str = “FF”; bool ok;

ushort hex = str.toUShort(&ok, 16); // hex == 255, ok == true ushort dec = str.toUShort(&ok, 10); // dec == 0, ok == false

See also number(), toShort(), and QLocale::toUShort().

source

pub unsafe fn to_u_short_0a(&self) -> c_ushort

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

Calls C++ function: unsigned short QString::toUShort() const.

C++ documentation:

Returns the string converted to an unsigned short using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails.

If a conversion error occurs, *ok is set to false; otherwise *ok is set to true.

If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.

The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toUShort()

Example:

QString str = “FF”; bool ok;

ushort hex = str.toUShort(&ok, 16); // hex == 255, ok == true ushort dec = str.toUShort(&ok, 10); // dec == 0, ok == false

See also number(), toShort(), and QLocale::toUShort().

source

pub unsafe fn to_ucs4(&self) -> CppBox<QVectorOfUint>

Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.

Calls C++ function: QVector<unsigned int> QString::toUcs4() const.

C++ documentation:

Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.

UCS-4 is a Unicode codec and therefore it is lossless. All characters from this string will be encoded in UCS-4. Any invalid sequence of code units in this string is replaced by the Unicode's replacement character (QChar::ReplacementCharacter, which corresponds to U+FFFD).

The returned vector is not NUL terminated.

This function was introduced in Qt 4.2.

See also fromUtf8(), toUtf8(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), and toWCharArray().

source

pub unsafe fn to_upper(&self) -> CppBox<QString>

Returns an uppercase copy of the string.

Calls C++ function: QString QString::toUpper() const.

C++ documentation:

Returns an uppercase copy of the string.


  QString str = "TeXt";
  str = str.toUpper();        // str == "TEXT"

The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toUpper()

See also toLower() and QLocale::toLower().

source

pub unsafe fn to_upper_mut(&self) -> CppBox<QString>

Returns an uppercase copy of the string.

Calls C++ function: QString QString::toUpper().

C++ documentation:

Returns an uppercase copy of the string.


  QString str = "TeXt";
  str = str.toUpper();        // str == "TEXT"

The case conversion will always happen in the 'C' locale. For locale dependent case folding use QLocale::toUpper()

See also toLower() and QLocale::toLower().

source

pub unsafe fn to_utf8(&self) -> CppBox<QByteArray>

Returns a UTF-8 representation of the string as a QByteArray.

Calls C++ function: QByteArray QString::toUtf8() const.

C++ documentation:

Returns a UTF-8 representation of the string as a QByteArray.

UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString.

See also fromUtf8(), toLatin1(), toLocal8Bit(), and QTextCodec.

source

pub unsafe fn to_utf8_mut(&self) -> CppBox<QByteArray>

Returns a UTF-8 representation of the string as a QByteArray.

Calls C++ function: QByteArray QString::toUtf8().

C++ documentation:

Returns a UTF-8 representation of the string as a QByteArray.

UTF-8 is a Unicode codec and can represent all characters in a Unicode string like QString.

See also fromUtf8(), toLatin1(), toLocal8Bit(), and QTextCodec.

source

pub unsafe fn to_w_char_array(&self, array: *mut wchar_t) -> c_int

Fills the array with the data contained in this QString object. The array is encoded in UTF-16 on platforms where wchar_t is 2 bytes wide (e.g. windows) and in UCS-4 on platforms where wchar_t is 4 bytes wide (most Unix systems).

Calls C++ function: int QString::toWCharArray(wchar_t* array) const.

C++ documentation:

Fills the array with the data contained in this QString object. The array is encoded in UTF-16 on platforms where wchar_t is 2 bytes wide (e.g. windows) and in UCS-4 on platforms where wchar_t is 4 bytes wide (most Unix systems).

array has to be allocated by the caller and contain enough space to hold the complete string (allocating the array with the same length as the string is always sufficient).

This function returns the actual length of the string in array.

Note: This function does not append a null character to the array.

This function was introduced in Qt 4.2.

See also utf16(), toUcs4(), toLatin1(), toUtf8(), toLocal8Bit(), and toStdWString().

source

pub unsafe fn trimmed(&self) -> CppBox<QString>

Returns a string that has whitespace removed from the start and the end.

Calls C++ function: QString QString::trimmed() const.

C++ documentation:

Returns a string that has whitespace removed from the start and the end.

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

Example:

QString str = “ lots\t of\nwhitespace\r\n “; str = str.trimmed(); // str == “lots\t of\nwhitespace”

Unlike simplified(), trimmed() leaves internal whitespace alone.

See also simplified().

source

pub unsafe fn trimmed_mut(&self) -> CppBox<QString>

Returns a string that has whitespace removed from the start and the end.

Calls C++ function: QString QString::trimmed().

C++ documentation:

Returns a string that has whitespace removed from the start and the end.

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

Example:

QString str = “ lots\t of\nwhitespace\r\n “; str = str.trimmed(); // str == “lots\t of\nwhitespace”

Unlike simplified(), trimmed() leaves internal whitespace alone.

See also simplified().

source

pub unsafe fn truncate(&self, pos: c_int)

Truncates the string at the given position index.

Calls C++ function: void QString::truncate(int pos).

C++ documentation:

Truncates the string at the given position index.

If the specified position index is beyond the end of the string, nothing happens.

Example:

QString str = “Vladivostok”; str.truncate(4); // str == “Vlad”

If position is negative, it is equivalent to passing zero.

See also chop(), resize(), left(), and QStringRef::truncate().

source

pub unsafe fn unicode(&self) -> Ptr<QChar>

Returns a Unicode representation of the string. The result remains valid until the string is modified.

Calls C++ function: const QChar* QString::unicode() const.

C++ documentation:

Returns a Unicode representation of the string. The result remains valid until the string is modified.

Note: The returned string may not be '\0'-terminated. Use size() to determine the length of the array.

See also setUnicode(), utf16(), and fromRawData().

source

pub unsafe fn utf16(&self) -> *const c_ushort

Returns the QString as a '\0'-terminated array of unsigned shorts. The result remains valid until the string is modified.

Calls C++ function: const unsigned short* QString::utf16() const.

C++ documentation:

Returns the QString as a ‘\0’-terminated array of unsigned shorts. The result remains valid until the string is modified.

The returned string is in host byte order.

See also setUtf16() and unicode().

Trait Implementations§

source§

impl Add<*const i8> for &QString

source§

fn add(self, s2: *const c_char) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s1, const char* s2).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Add<Ref<QByteArray>> for &QString

source§

fn add(self, ba: Ref<QByteArray>) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s, const QByteArray& ba).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Add<Ref<QChar>> for &QString

source§

fn add(self, s2: Ref<QChar>) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s1, QChar s2).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Add<Ref<QString>> for &QString

source§

fn add(self, s2: Ref<QString>) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s1, const QString& s2).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Add<Ref<QStringRef>> for &QString

source§

fn add(self, s2: Ref<QStringRef>) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s1, const QStringRef& s2).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Add<i8> for &QString

source§

fn add(self, c: c_char) -> CppBox<QString>

Calls C++ function: QString operator+(const QString& s, char c).

§

type Output = CppBox<QString>

The resulting type after applying the + operator.
source§

impl Begin for QString

source§

unsafe fn begin(&self) -> Ptr<QChar>

This function overloads begin().

Calls C++ function: const QChar* QString::begin() const.

C++ documentation:

This function overloads begin().

§

type Output = Ptr<QChar>

Output type.
source§

impl BeginMut for QString

source§

unsafe fn begin_mut(&self) -> Ptr<QChar>

Returns an STL-style iterator pointing to the first character in the string.

Calls C++ function: QChar* QString::begin().

C++ documentation:

Returns an STL-style iterator pointing to the first character in the string.

See also constBegin() and end().

§

type Output = Ptr<QChar>

Output type.
source§

impl CppDeletable for QString

source§

unsafe fn delete(&self)

Destroys the string.

Calls C++ function: [destructor] void QString::~QString().

C++ documentation:

Destroys the string.

source§

impl Data for QString

source§

unsafe fn data(&self) -> Ptr<QChar>

This is an overloaded function.

Calls C++ function: const QChar* QString::data() const.

C++ documentation:

This is an overloaded function.

Note: The returned string may not be '\0'-terminated. Use size() to determine the length of the array.

See also fromRawData().

§

type Output = Ptr<QChar>

Return type of data() function.
source§

impl DataMut for QString

source§

unsafe fn data_mut(&self) -> Ptr<QChar>

Returns a pointer to the data stored in the QString. The pointer can be used to access and modify the characters that compose the string.

Calls C++ function: QChar* QString::data().

C++ documentation:

Returns a pointer to the data stored in the QString. The pointer can be used to access and modify the characters that compose the string.

Unlike constData() and unicode(), the returned data is always '\0'-terminated.

Example:

QString str = “Hello world”; QChar *data = str.data(); while (!data->isNull()) { qDebug() << data->unicode(); ++data; }

Note that the pointer remains valid only as long as the string is not modified by other means. For read-only access, constData() is faster because it never causes a deep copy to occur.

See also constData() and operator[]().

§

type Output = Ptr<QChar>

Return type of data_mut() function.
source§

impl End for QString

source§

unsafe fn end(&self) -> Ptr<QChar>

This function overloads end().

Calls C++ function: const QChar* QString::end() const.

C++ documentation:

This function overloads end().

§

type Output = Ptr<QChar>

Output type.
source§

impl EndMut for QString

source§

unsafe fn end_mut(&self) -> Ptr<QChar>

Returns an STL-style iterator pointing to the imaginary character after the last character in the string.

Calls C++ function: QChar* QString::end().

C++ documentation:

Returns an STL-style iterator pointing to the imaginary character after the last character in the string.

See also begin() and constEnd().

§

type Output = Ptr<QChar>

Output type.
source§

impl<'a> From<&'a QString> for String

Allows to convert Qt strings to std strings

source§

fn from(s: &'a QString) -> String

Converts to this type from the input type.
source§

impl Ge<*const i8> for QString

source§

unsafe fn ge(&self, s: &*const c_char) -> bool

This function overloads operator>=().

Calls C++ function: bool QString::operator>=(const char* s) const.

C++ documentation:

This function overloads operator>=().

The other const char pointer is converted to a QString using the fromUtf8() function.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Ge<Ref<QByteArray>> for QString

source§

unsafe fn ge(&self, s: &Ref<QByteArray>) -> bool

This function overloads operator>=().

Calls C++ function: bool QString::operator>=(const QByteArray& s) const.

C++ documentation:

This function overloads operator>=().

The other byte array is converted to a QString using the fromUtf8() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Ge<Ref<QChar>> for QString

source§

unsafe fn ge(&self, rhs: &Ref<QChar>) -> bool

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator>=(const QString& lhs, QChar rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

source§

impl Ge<Ref<QLatin1String>> for QString

source§

unsafe fn ge(&self, s: &Ref<QLatin1String>) -> bool

Returns true if this string is lexically greater than or equal to parameter string other. Otherwise returns false.

Calls C++ function: bool QString::operator>=(QLatin1String s) const.

C++ documentation:

Returns true if this string is lexically greater than or equal to parameter string other. Otherwise returns false.

This function overloads operator>=().

source§

impl Ge<Ref<QStringRef>> for QString

source§

unsafe fn ge(&self, rhs: &Ref<QStringRef>) -> bool

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator>=(const QString& lhs, const QStringRef& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false.

source§

impl Gt<*const i8> for QString

source§

unsafe fn gt(&self, s: &*const c_char) -> bool

This function overloads operator>().

Calls C++ function: bool QString::operator>(const char* s) const.

C++ documentation:

This function overloads operator>().

The other const char pointer is converted to a QString using the fromUtf8() function.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Gt<Ref<QByteArray>> for QString

source§

unsafe fn gt(&self, s: &Ref<QByteArray>) -> bool

This function overloads operator>().

Calls C++ function: bool QString::operator>(const QByteArray& s) const.

C++ documentation:

This function overloads operator>().

The other byte array is converted to a QString using the fromUtf8() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Gt<Ref<QChar>> for QString

source§

unsafe fn gt(&self, rhs: &Ref<QChar>) -> bool

Calls C++ function: bool operator>(const QString& lhs, QChar rhs).

source§

impl Gt<Ref<QLatin1String>> for QString

source§

unsafe fn gt(&self, s: &Ref<QLatin1String>) -> bool

This function overloads operator>().

Calls C++ function: bool QString::operator>(QLatin1String s) const.

C++ documentation:

This function overloads operator>().

Returns true if this string is lexically greater than the parameter string other; otherwise returns false.

source§

impl Gt<Ref<QStringRef>> for QString

source§

unsafe fn gt(&self, rhs: &Ref<QStringRef>) -> bool

Calls C++ function: bool operator>(const QString& lhs, const QStringRef& rhs).

source§

impl Le<*const i8> for QString

source§

unsafe fn le(&self, s: &*const c_char) -> bool

This function overloads operator<=().

Calls C++ function: bool QString::operator<=(const char* s) const.

C++ documentation:

This function overloads operator<=().

The other const char pointer is converted to a QString using the fromUtf8() function.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Le<Ref<QByteArray>> for QString

source§

unsafe fn le(&self, s: &Ref<QByteArray>) -> bool

This function overloads operator<=().

Calls C++ function: bool QString::operator<=(const QByteArray& s) const.

C++ documentation:

This function overloads operator<=().

The other byte array is converted to a QString using the fromUtf8() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Le<Ref<QChar>> for QString

source§

unsafe fn le(&self, rhs: &Ref<QChar>) -> bool

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator<=(const QString& lhs, QChar rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

source§

impl Le<Ref<QLatin1String>> for QString

source§

unsafe fn le(&self, s: &Ref<QLatin1String>) -> bool

Returns true if this string is lexically less than or equal to parameter string other. Otherwise returns false.

Calls C++ function: bool QString::operator<=(QLatin1String s) const.

C++ documentation:

Returns true if this string is lexically less than or equal to parameter string other. Otherwise returns false.

This function overloads operator<=().

source§

impl Le<Ref<QStringRef>> for QString

source§

unsafe fn le(&self, rhs: &Ref<QStringRef>) -> bool

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

Calls C++ function: bool operator<=(const QString& lhs, const QStringRef& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2):

Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false.

source§

impl Lt<*const i8> for QString

source§

unsafe fn lt(&self, s: &*const c_char) -> bool

Returns true if this string is lexically less than string other. Otherwise returns false.

Calls C++ function: bool QString::operator<(const char* s) const.

C++ documentation:

Returns true if this string is lexically less than string other. Otherwise returns false.

This function overloads operator<().

The other const char pointer is converted to a QString using the fromUtf8() function.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Lt<Ref<QByteArray>> for QString

source§

unsafe fn lt(&self, s: &Ref<QByteArray>) -> bool

This function overloads operator<().

Calls C++ function: bool QString::operator<(const QByteArray& s) const.

C++ documentation:

This function overloads operator<().

The other byte array is converted to a QString using the fromUtf8() function. If any NUL characters ('\0') are embedded in the byte array, they will be included in the transformation.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

source§

impl Lt<Ref<QChar>> for QString

source§

unsafe fn lt(&self, rhs: &Ref<QChar>) -> bool

Calls C++ function: bool operator<(const QString& lhs, QChar rhs).

source§

impl Lt<Ref<QLatin1String>> for QString

source§

unsafe fn lt(&self, s: &Ref<QLatin1String>) -> bool

This function overloads operator<().

Calls C++ function: bool QString::operator<(QLatin1String s) const.

C++ documentation:

This function overloads operator<().

Returns true if this string is lexically less than the parameter string called other; otherwise returns false.

source§

impl Lt<Ref<QStringRef>> for QString

source§

unsafe fn lt(&self, rhs: &Ref<QStringRef>) -> bool

Calls C++ function: bool operator<(const QString& lhs, const QStringRef& rhs).

source§

impl PartialEq<*const i8> for QString

source§

fn eq(&self, s: &*const c_char) -> bool

This function overloads operator==().

Calls C++ function: bool QString::operator==(const char* s) const.

C++ documentation:

This function overloads operator==().

The other const char pointer is converted to a QString using the fromUtf8() function.

You can disable this operator by defining 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.

See also QT_NO_CAST_FROM_ASCII.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QByteArray>> for QString

source§

fn eq(&self, s: &Ref<QByteArray>) -> bool

This function overloads operator==().

Calls C++ function: bool QString::operator==(const QByteArray& s) const.

C++ documentation:

This function overloads operator==().

The other byte array is converted to a QString using the fromUtf8() function. This function stops conversion at the first NUL character found, or the end of the byte array.

You can disable this operator by defining 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.

Returns true if this string is lexically equal to the parameter string other. Otherwise returns false.

See also QT_NO_CAST_FROM_ASCII.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QChar>> for QString

source§

fn eq(&self, rhs: &Ref<QChar>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(const QString& lhs, QChar rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2):

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QLatin1String>> for QString

source§

fn eq(&self, s: &Ref<QLatin1String>) -> bool

This function overloads operator==().

Calls C++ function: bool QString::operator==(QLatin1String s) const.

C++ documentation:

This function overloads operator==().

Returns true if this string is equal to other; otherwise returns false.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Ref<QStringRef>> for QString

source§

fn eq(&self, rhs: &Ref<QStringRef>) -> bool

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(const QString& lhs, const QStringRef& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2):

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Size for QString

source§

unsafe fn size(&self) -> usize

Returns the number of characters in this string.

Calls C++ function: int QString::size() const.

C++ documentation:

Returns the number of characters in this string.

The last character in the string is at position size() - 1.

Example:

QString str = “World”; int n = str.size(); // n == 5 str.data()[0]; // returns ‘W’ str.data()[4]; // returns ‘d’

See also isEmpty() and resize().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.