CopperSpice API  1.9.1
QString8 Class Reference

Provides a UTF-8 string class. More...

Inherits CsString

Classes

class  const_iterator
 STL style const iterator for QString8 More...
 
class  iterator
 STL style iterator for QString8 More...
 

Public Typedefs

using const_reverse_iterator = CsString::CsStringReverseIterator< const_iterator >
 
using difference_type = std::ptrdiff_t
 
using reverse_iterator = CsString::CsStringReverseIterator< iterator >
 
using size_type = std::ptrdiff_t
 
using storage_type = char
 
using value_type = QChar32
 

Public Types

enum  NormalizationForm
 

Public Methods

 QString8 ()
 
template<int N>
 QString8 (const char (&cStr)[N])
 
 QString8 (const char8_t *str)
 
 QString8 (const char8_t *str, size_type size)
 
 QString8 (const QByteArray &str)
 
 QString8 (const QChar32 *data, size_type numOfChars=-1)
 
 QString8 (const QString8 &other) = default
 
 QString8 (const_iterator begin, const_iterator end)
 
template<typename Iterator >
 QString8 (Iterator begin, Iterator end)
 
 QString8 (QChar32 c)
 
 QString8 (QChar32::SpecialCharacter c)
 
 QString8 (QString8 &&other) = default
 
 QString8 (QStringView8 str)
 
 QString8 (size_type numOfChars, QChar32 c)
 
 ~QString8 () = default
 
QString8 & append (char32_t c)
 
QString8 & append (const QChar32 *data, size_type numOfChars)
 
QString8 & append (const QString8 &other)
 
QString8 & append (const_iterator iter_begin, const_iterator iter_end)
 
QString8 & append (QChar32 c)
 
QString8 & append (QStringView8 str)
 
QString8 & append (QStringView8 str, size_type indexStart, size_type numOfChars)
 
QChar32 at (size_type index) const
 
QChar32 back () const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void chop (size_type numOfChars)
 
void clear ()
 
int compare (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
int compare (QStringView8 str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator constBegin () const
 
const char * constData () const
 
const_iterator constEnd () const
 
bool contains (char ch, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool contains (const QRegularExpression8 &regExp) const
 
bool contains (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool contains (QChar32 c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool contains (QStringView8 str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
size_type count () const
 
size_type count (const QRegularExpression8 &regExp) const
 
size_type count (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
size_type count (QChar32 c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
size_type count (QStringView8 str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
const char * data () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool endsWith (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (QChar32 c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool endsWith (QStringView8 str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QString8 & fill (QChar32 c, size_type numOfChars=-1)
 
QChar32 first () const
 
template<typename SP = QStringParser, typename... Ts>
QString8 formatArg (Ts &&...args) const
 
template<typename SP = QStringParser, typename... Ts>
QString8 formatArgs (Ts &&...args) const
 
QChar32 front () const
 
size_type indexOf (const QRegularExpression8 &regExp, size_type from=0) const
 
size_type indexOf (const QString8 &str, size_type from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
size_type indexOf (QChar32 c, size_type from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator indexOfFast (const QRegularExpression8 &regExp) const
 
const_iterator indexOfFast (const QRegularExpression8 &regExp, const_iterator from) const
 
const_iterator indexOfFast (const QString8 &str) const
 
const_iterator indexOfFast (const QString8 &str, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator indexOfFast (QChar32 c) const
 
const_iterator indexOfFast (QChar32 c, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator indexOfFast (QStringView8 str, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QString8 & insert (const_iterator first, const QString8 &str)
 
template<typename Iterator >
QString8 & insert (const_iterator first, Iterator begin, Iterator end)
 
QString8 & insert (size_type indexStart, const QChar32 *data, size_type numOfChars)
 
QString8 & insert (size_type indexStart, const QString8 &str)
 
QString8 & insert (size_type indexStart, QChar32 c)
 
QString8 & insert (size_type indexStart, QStringView8 str)
 
QString8 & insert (size_type indexStart, QStringView8 str, size_type srcStart, size_type numOfChars)
 
bool isEmpty () const
 
QChar32 last () const
 
size_type lastIndexOf (const QString8 &str, size_type from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
size_type lastIndexOf (QChar32 c, size_type from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator lastIndexOfFast (const QString8 &str) const
 
const_iterator lastIndexOfFast (const QString8 &str, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator lastIndexOfFast (QChar32 c) const
 
const_iterator lastIndexOfFast (QChar32 c, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_iterator lastIndexOfFast (QStringView8 str, const_iterator from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QString8 left (size_type numOfChars) const
 
QString8 leftJustified (size_type width, QChar32 fill=UCHAR (' '), bool truncate=false) const
 
QStringView8 leftView (size_type numOfChars) const
 
size_type length () const
 
int localeAwareCompare (const QString8 &str) const
 
int localeAwareCompare (QStringView8 str) const
 
QString8 mid (const_iterator iter, size_type numOfChars=-1) const
 
QString8 mid (size_type indexStart, size_type numOfChars=-1) const
 
QStringView8 midView (const_iterator iter, size_type numOfChars=-1) const
 
QStringView8 midView (size_type indexStart, size_type numOfChars=-1) const
 
QString8 normalized (QString8::NormalizationForm mode, QChar32::UnicodeVersion version=QChar32::Unicode_Unassigned) const
 
QString8 & operator+= (const QString8 &other)
 
QString8 & operator+= (QChar32 c)
 
QString8 & operator+= (QChar32::SpecialCharacter c)
 
QString8 & operator+= (QStringView8 str)
 
QString8 & operator= (const QString8 &other) = default
 
QString8 & operator= (QChar32 c)
 
QString8 & operator= (QString8 &&other) = default
 
QString8 & operator= (QStringView8 str)
 
QChar32 operator[] (size_type index) const
 
QString8 & prepend (char32_t c)
 
QString8 & prepend (const QChar32 *data, size_type numOfChars)
 
QString8 & prepend (const QString8 &other)
 
QString8 & prepend (const_iterator iter_begin, const_iterator iter_end)
 
QString8 & prepend (QChar32 c)
 
void push_back (const QString8 &other)
 
void push_back (QChar32 c)
 
void push_front (const QString8 &other)
 
void push_front (QChar32 c)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
QString8 & remove (const QRegularExpression8 &regExp)
 
QString8 & remove (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & remove (QChar32 c, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & remove (size_type indexStart, size_type numOfChars)
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
QString8 repeated (size_type count) const
 
QString8 & replace (const QChar32 *before, size_type beforeSize, const QChar32 *after, size_type afterSize, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & replace (const QRegularExpression8 &regExp, const QString8 &after)
 
QString8 & replace (const QString8 &before, const QString8 &after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & replace (const_iterator first, const_iterator last, const QString8 &str)
 
template<typename Iterator >
QString8 & replace (const_iterator first1, const_iterator last1, Iterator first2, Iterator last2)
 
QString8 & replace (QChar32 before, QChar32 after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & replace (QChar32 c, const QString8 &after, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
QString8 & replace (size_type indexStart, size_type numOfChars, const QChar32 *data, size_type sizeStr)
 
QString8 & replace (size_type indexStart, size_type numOfChars, const QString8 &str)
 
QString8 & replace (size_type indexStart, size_type numOfChars, const QString8 &str, size_type sizeStr)
 
QString8 & replace (size_type indexStart, size_type numOfChars, QChar32 c)
 
void resize (size_type numOfChars)
 
void resize (size_type numOfChars, QChar32 c)
 
QString8 right (size_type count) const
 
QString8 rightJustified (size_type width, QChar32 fill=UCHAR (' '), bool truncate=false) const
 
QStringView8 rightView (size_type count) const
 
template<typename SP = QStringParser, typename... Ts>
QString8 section (const QString8 &separator, Ts...args) const
 
template<typename SP = QStringParser, typename... Ts>
QString8 section (QChar32 separator, Ts...args) const
 
QString8 simplified () &&
 
QString8 simplified () const &
 
size_type size () const
 
size_type size_storage () const
 
template<typename SP = QStringParser, typename... Ts>
auto split (const QRegularExpression &separator, Ts...args) const
 
template<typename SP = QStringParser, typename... Ts>
auto split (const QString8 &separator, Ts...args) const
 
template<typename SP = QStringParser, typename... Ts>
auto split (QChar32 separator, Ts...args) const
 
void squeeze ()
 
bool startsWith (const QString8 &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (QChar32 c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
bool startsWith (QStringView8 str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
const_storage_iterator storage_begin () const
 
const_storage_iterator storage_end () const
 
const_storage_reverse_iterator storage_rbegin () const
 
const_storage_reverse_iterator storage_rend () const
 
void swap (QString8 &other)
 
QString8 toCaseFolded () &&
 
QString8 toCaseFolded () const &
 
CFStringRef toCFString () const
 
template<typename SP = QStringParser>
double toDouble (bool *ok=nullptr) const
 
template<typename SP = QStringParser>
float toFloat (bool *ok=nullptr) const
 
QString8 toHtmlEscaped () const
 
template<typename R , typename SP = QStringParser>
toInteger (bool *ok=nullptr, int base=10) const
 
QByteArray toLatin1 () const
 
QString8 toLower () &&
 
QString8 toLower () const &
 
NSString * toNSString () const
 
std::string toStdString () const
 
std::wstring toStdWString () const
 
QString8 toUpper () &&
 
QString8 toUpper () const &
 
QString16 toUtf16 () const
 
QByteArray toUtf8 () const
 
QString8 trimmed () &&
 
QString8 trimmed () const &
 
void truncate (size_type length)
 
const uint8_t * utf8 () const
 

Static Public Methods

static int compare (const QString8 &str1, const QString8 &str2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
static int compare (QStringView8 str1, QStringView8 str2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
static QString8 fromCFString (CFStringRef string)
 
static QString8 fromLatin1 (const char *str, size_type numOfChars=-1)
 
static QString8 fromLatin1 (const QByteArray &str)
 
static QString8 fromNSString (const NSString *string)
 
static QString8 fromStdString (const std::string &str, size_type numOfChars=-1)
 
static QString8 fromStdWString (const std::wstring &str, size_type numOfChars=-1)
 
static QString8 fromUtf16 (const char16_t *str, size_type numOfChars=-1)
 
static QString8 fromUtf16 (const QString16 &str)
 
static QString8 fromUtf8 (const char *str, size_type numOfChars=-1)
 
static QString8 fromUtf8 (const char8_t *str, size_type numOfChars=-1)
 
static QString8 fromUtf8 (const QByteArray &str)
 
static int localeAwareCompare (const QString8 &str1, const QString8 &str2)
 
static int localeAwareCompare (QStringView8 str1, QStringView8 str2)
 
template<typename SP = QStringParser>
static QString8 number (double value, char format= 'g', int precision=6)
 
template<typename V , typename SP = QStringParser>
static QString8 number (V value, int base=10)
 

Related Functions

These are not member functions

bool operator!= (const char (&cString)[N], const QString8 &str)
 
bool operator!= (const QString8 &str, const char (&cString)[N])
 
bool operator!= (const QString8 &str1, const QString8 &str2)
 
QString8 operator+ (const char (&cString)[N], const QString8 &str)
 
QString8 operator+ (const QString8 &str, const char (&cString)[N])
 
QString8 operator+ (const QString8 &str, QChar32 c)
 
QString8 operator+ (const QString8 &str1, const QString8 &str2)
 
QString8 operator+ (QChar32 c, const QString8 &str)
 
QString8 && operator+ (QString8 &&str, const char (&cString)[N])
 
QString8 && operator+ (QString8 &&str, QChar32 c)
 
QString8 && operator+ (QString8 &&str1, const QString8 &str2)
 
bool operator< (const char (&cString)[N], const QString8 &str)
 
bool operator< (const QString8 &str, const char (&cString)[N])
 
bool operator< (const QString8 &str1, const QString8 &str2)
 
QDataStreamoperator<< (QDataStream &stream, const QString8 &str)
 
bool operator<= (const char (&cString)[N], const QString8 &str)
 
bool operator<= (const QString8 &str, const char (&cString)[N])
 
bool operator<= (const QString8 &str1, const QString8 &str2)
 
bool operator== (const char (&cString)[N], const QString8 &str)
 
bool operator== (const QString8 &str, const char (&cString)[N])
 
bool operator== (const QString8 &str1, const QString8 &str2)
 
bool operator> (const char (&cString)[N], const QString8 &str)
 
bool operator> (const QString8 &str, const char (&cString)[N])
 
bool operator> (const QString8 &str1, const QString8 &str2)
 
bool operator>= (const char (&cString)[N], const QString8 &str)
 
bool operator>= (const QString8 &str, const char (&cString)[N])
 
bool operator>= (const QString8 &str1, const QString8 &str2)
 
QDataStreamoperator>> (QDataStream &stream, QString8 &str)
 
 QString
 
void swap (QString8 &str1, QString8 &str2)
 

Detailed Description

QString8 provides a UTF-8 Unicode aware string class which stores a sequence of QChar32 elements. Each QChar32 corresponds to one Unicode code point. Unicode is an international standard which supports the majority of human languages.

CopperSpice also provides QByteArray to store raw bytes and traditional 8-bit null terminated strings. QString8 is the appropriate string class in almost all cases. The QByteArray class is appropriate when storing raw binary data. QString16 should only be used when interfacing with external libraries which expect UTF-16 encoded data.

Using the QString8 class is synonymous with using QString. There is a typedef in CopperSpice which defines QString as equivalent to QString8.

For more information about strings, code points, text encodings, and internationalization refer to Unicode and Internationalization.

Initializing a String

One way to initialize a QString8 is to pass a string literal to the constructor. The following code creates a QString8 of size 5 containing the data "Hello".

QString str = "Hello";

You can also construct a string using an array of QChar32 as shown below.

static const QChar32 data[4] = { 0x0055, 0x006e, 0x10e3, 0x03a3 };
QString str(data, 4);

A third approach is to set the size of the string using resize() and then initialize the data, character by character. QString8 uses zero based indexes. To access the code point at a particular index position use operator[](). For non-const strings operator[]() returns a reference to a code point which can be used on the left side of an assignment.

QString str;
str.resize(4);
str[0] = QChar32('U');
str[1] = QChar32('n');
str[2] = QChar32(0x10e3);
str[3] = QChar32(0x03a3);

A QString8 can contain '\0' characters. The size() method always returns the size of the whole string including the embedded null characters.

String literals can be passed to methods which take a QString8 as an argument. To compare a QString8 with a string literal use code similar to the following.

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

Modifying Strings

QString8 provides the following basic methods for modifying strings: append(), prepend(), insert(), replace(), and remove().

QString str = "and";
str.prepend("rock "); // str == "rock and"
str.append(" roll"); // str == "rock and roll"
str.replace(5, 3, "&"); // str == "rock & roll"

The replace() and remove() methods first two arguments are the position from which to start erasing and the number of characters that should be erased. If you want to replace all occurrences of a particular substring with another, use one of the two-parameter replace() overloads.

A frequent requirement is to remove whitespace characters from a string ('\n', '\t', ' ', etc.). If you want to remove whitespace from both ends of a QString8, use the trimmed() method. If you want to remove whitespace from both ends and replace multiple consecutive whitespaces with a single space character within the string, use simplified().

If you want to find all occurrences of a particular character or substring in a QString8, use the indexOf() or lastIndexOf() methods. The former searches forward starting from a given index position, the latter searches backward. Both return the index position of the character or substring if found, otherwise they return -1.

The following is a typical loop which finds all occurrences of a particular substring.

QString str = "To dream the impossible dream. . .";
int pos = 0;
while ((pos = str.indexOf("dream", pos)) != -1) {
qDebug() << "Found 'dream' tag at index position" << pos;
++pos;
}

To retrieve an upper or lowercase version of a string use toUpper() or toLower().

Lists of strings are handled by the QStringList class. To obtain a list of strings from a string list that contain a particular substring or which match a particular QRegularExpression, using QStringList::filter().

Querying String Data

To check if a QString8 starts or ends with a particular substring use startsWith() or endsWith(). To verify if a QString8 contains a particular character or substring, use the contains() method. To find out how many times a particular character or substring occurs in the string, use count().

A QString8 can be compared using overloaded operators such as operator<(), operator<=(), operator==(), operator>=(), etc. The comparison is based exclusively on the numeric Unicode values of the characters. The result may not be what is expected if the string contains non-ASCII characters. In this case, a better way to compare is to use QString8::localeAwareCompare() method.

To obtain a pointer to the raw data call constData(). This method returns a pointer to the beginning of the null terminated string. The pointer is guaranteed to remain valid until a non-const method is called on this string.

Removed or Unsupported Methods

The following methods and typedefs are either unsafe, do not work with all Unicode characters, or are unnecessary when using QString8.

MethodDescription
asprintf() Since C variadic functions are not type safe, use the QTextStream class or QStringParser::formatArgs
capacity() Variable length encodings do not support a fixed capacity, refer to resize()
fromAscii() Refer to fromLatin1()
fromLocal8Bit() Result could be undefined or different based on the platform and therefore removed
fromWCharArray() Result could be different based on the platforms definition of wchar and therefore removed
isNull() The distinction between empty and null is error prone and therefore removed
isRightToLeft() Direction is not a boolean property of a string and therefore removed
operator[] In place edit is not supported, use replace() instead
reserve() Variable length encodings do not support a fixed capacity, refer to resize()
setNum() Replace with QString8::number or QStringParser::number, for an example refer to Migrating setNum
setUtf16() Replace with fromUtf16()
toAscii() Refer to toLatin1()
toLocal8Bit() Result could be undefined or different based on the platform and therefore removed
toWCharArray() Result could be different based on the platforms definition of wchar and therefore removed
unicode() Replace with constData()
utf16() Replace with utf8()
vasprintf() Since C variadic functions are not type safe, use the QTextStream class or QStringParser::formatArgs()
QT_NO_CAST_FROM_ASCII Replaced with CS_STRING_ALLOW_UNSAFE
QT_NO_CAST_TO_ASCII Replaced with CS_STRING_ALLOW_UNSAFE
QT_RESTRICTED_CAST_FROM_ASCII Replaced with CS_STRING_ALLOW_UNSAFE

The following methods or overloads have been removed since they only work with Latin-1 characters. Replacement syntax is shown for each method.

MethodDescription
append(const QByteArray &str) Use append(QString8::fromLatin1(str))
prepend(const QByteArray &str) Use prepend(QString8::fromLatin1(str))
setUnicode() Construct a new QString8() which takes a const QChar32 *
toInt Use toInteger<int>()
toUInt Use toInteger<uint>()
toLong Use toInteger<long>()
toULong Use toInteger<ulong>()
toLongLong Use toInteger<qint64>()
toULongLong Use toInteger<quint64>()
toShort Use toInteger<short>()
toUShort Use toInteger<ushort>()

Migrating QString Syntax

The following examples show how to update code which uses the QString class.

forward declaration
If your code contained a forward declaration for QString replace it with the following include.
class QString; // prior syntax
#include <qstringfwd.h> // new syntax
operator[]

Use replace()

QString str = "grey";
str[2] = 'a'; // prior syntax
str.replace(2, 1, 'a'); // new syntax

setNum()
Use number()
QString str = "anything";
int value = 42;
str.setNum(value); // prior syntax
str = QString::number(value); // new syntax, sets str to "42"
str = QStringParser::number<QString>(value); // alternate syntax
arg()
Use formatArg()
QString str = "Processing file #%1";
int cnt = 5;
std::cout << str.arg(cnt); // prior syntax, prints "Processing file #5"
std::cout << str.formatArg(cnt); // new syntax, prints "Processing file #5"
std::cout << QStringParser::formatArg(str, cnt); // alternate syntax
Qt::escape(str)
Use str.toHtmlEscaped()

Member Typedef Documentation

Provides an STL style const reverse iterator for QString8.

See also
QString8::iterator

Typedef for an integer type representing the distance between two elements in a QString8.

Provides an STL style non-const reverse iterator for QString8.

See also
QString8::const_iterator

Typedef for an integer type representing sizes in a QString8.

Typedef for char.

Typedef for the elements stored in a QString8.

Member Enumeration Documentation

This enum describes the various normalized forms of Unicode text.

ConstantValueDescription
QString::NormalizationForm_D 0 Canonical Decomposition
QString::NormalizationForm_C 1 Canonical Decomposition followed by Canonical Composition
QString::NormalizationForm_KD 2 Compatibility Decomposition
QString::NormalizationForm_KC 3 Compatibility Decomposition followed by Canonical Composition
See also
normalized(), Unicode Standard Annex #15

Constructor & Destructor Documentation

QString8::QString8 ( )
inline

Constructs an empty string.

See also
isEmpty()
QString8::QString8 ( QChar32  c)

Constructs a string of size 1 containing the code point c.

QString8::QString8 ( size_type  numOfChars,
QChar32  c 
)

Constructs a string of the given numOfChars with every code point set to c.

See also
fill()
QString8::QString8 ( QChar32::SpecialCharacter  c)
inline

Constructs a string using the special Unicode character c.

QString8::QString8 ( const QChar32 data,
size_type  numOfChars = -1 
)
inline

Constructs a string with the first numOfChars number of code points pointed to by data. If numOfChars is not specified, the entire null terminated string will be used.

QString8::QString8 ( const_iterator  begin,
const_iterator  end 
)
inline

Constructs a string using the const iterator range begin to end.

template<int N>
QString8::QString8 ( const char (&)  cStr[N])
inline

Constructs a string using the given string literal cStr.

QString8::QString8 ( const QByteArray str)
inline

Constructs a string initialized with str. The entire string is copied including any null characters. The contents of the QByteArray must be valid UTF-8.

This constructor will only be available if you define CS_STRING_ALLOW_UNSAFE.

Warning
It is strongly advised not to use this method. Instead your code should call QString8::fromLatin1() or QString8::fromUtf8().
template<typename Iterator >
QString8::QString8 ( Iterator  begin,
Iterator  end 
)
inline

Constructs a string using the iterator range begin to end. The elements in the range must be implicitly convertible to QChar32.

QString8::QString8 ( QStringView8  str)
inline

Constructs a string using the string view str.

QString8::QString8 ( const QString8 &  other)
default

Copy constructs a new QString8 from other.

See also
operator=()
QString8::QString8 ( QString8 &&  other)
default

Move constructs a new QString8 from other.

QString8::~QString8 ( )
default

Destroys this string.

QString8::QString8 ( const char8_t *  str)
inline

Constructs a QString8 using the null terminated UTF-8 string str. Uses the specified or default constructed allocator.

The type char8_t was added in C++20. For more information refer the Using C++20 documentation.

QString8::QString8 ( const char8_t *  str,
size_type  size 
)
inline

Constructs a QString8 using the first size code points of the null terminated UTF-8 string str. Uses the specified or default constructed allocator.

The type char8_t was added in C++20. For more information refer the Using C++20 documentation.

Method Documentation

QString8 & QString8::append ( char32_t  c)
inline

Appends the code point c to this string and returns a reference to this string.

QString8 & QString8::append ( const QChar32 data,
size_type  numOfChars 
)
inline

Appends the first numOfChars number of code points pointed to by data.

QString8 & QString8::append ( const QString8 &  other)
inline

Appends the string other to the end of this string. Returns a reference to this string.

QString str1 = "free";
QString str2 = "dom";
str1.append(str2); // str1 == "freedom"
See also
operator+=(), insert(), prepend()
QString8 & QString8::append ( const_iterator  iter_begin,
const_iterator  iter_end 
)
inline

Appends from iter_begin to iter_end, to the end of this string. Returns a reference to this string.

QString8 & QString8::append ( QChar32  c)
inline

Appends the code point c to this string and returns a reference to this string.

QString8 & QString8::append ( QStringView8  str)
inline

Appends the given string view str to this string. Returns a reference to this string.

QString8 & QString8::append ( QStringView8  str,
size_type  indexStart,
size_type  numOfChars 
)
inline

Appends the given string view str to this string, beginning at position indexStart in str and continuing for the length numOfChars. Returns a reference to this string.

QChar32 QString8::at ( size_type  index) const
inline

Returns the code point at the given position index in the string. The index must be a valid position in the string.

QString str;
str = "Sourdough bread is a trademark of San Francisco";
for (int i = 0; i < str.size(); ++i) {
if (str.at(i) >= QUChar('a') && str.at(i) <= QUChar('f')) {
qDebug() << "Found character in range [a-f]";
}
}
See also
operator[]()
QChar32 QString8::back ( ) const
inline

Returns the last code point in this string.

See also
front(), at(), operator[]()
iterator QString8::begin ( )
inline

Returns an STL style iterator pointing to the first code point in the string.

See also
constBegin(), end()
const_iterator QString8::begin ( ) const
inline

Returns a const STL style iterator pointing to the first code point in the string.

const_iterator QString8::cbegin ( ) const
inline

Returns a const STL style iterator pointing to the first code point in the string.

See also
begin(), cend()
const_iterator QString8::cend ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item after the last code point in the string.

See also
cbegin(), end()
void QString8::chop ( size_type  numOfChars)

Removes numOfChar code points counting from the end of the string. If numOfChar is greater than size() the result is an empty string.

QString str("LOGOUT");
str.chop(3); // str == "LOG"

To remove characters from the beginning of the string, use remove().

See also
truncate(), resize(), remove()
void QString8::clear ( )
inline

Clears the contents of the string and makes it empty.

See also
resize(), isEmpty()
int QString8::compare ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Compares this string with the string str. If cs is Qt::CaseSensitive the comparison is case sensitive, otherwise the comparison is case insensitive.

  • if this string is less than str, returns -1
  • if this string is equal to str, returns 0
  • if this string is greater than str, returns 1
int QString8::compare ( const QString8 &  str1,
const QString8 &  str2,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
inlinestatic

Compares str1 with str2. If cs is Qt::CaseSensitive the comparison is case sensitive, otherwise the comparison is case insensitive.

  • if str1 is less than str2, returns -1
  • if str1 is equal to str2, returns 0
  • if str1 is greater than str2, returns 1
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
See also
operator==(), operator<(), operator>()
int QString8::compare ( QStringView8  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Compares this string with the string view str. If cs is Qt::CaseSensitive the comparison is case sensitive, otherwise the comparison is case insensitive.

  • if this string is less than str, returns -1
  • if this string is equal to str, returns 0
  • if this string is greater than str, returns 1
int QString8::compare ( QStringView8  str1,
QStringView8  str2,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
static

Compares string view str1 with the string view str2. If cs is Qt::CaseSensitive the comparison is case sensitive, otherwise the comparison is case insensitive.

  • if str1 is less than str2, returns -1
  • if str1 is equal to str2, returns 0
  • if str1 is greater than str2, returns 1
const_iterator QString8::constBegin ( ) const
inline

Returns a const STL style iterator pointing to the first code point in the string.

See also
begin(), constEnd()
const char * QString8::constData ( ) const
inline

Returns a pointer to the null terminated data stored in the string. The pointer is valid until the string is modified.

See also
data(), operator[]()
const_iterator QString8::constEnd ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item after the last code point in the string.

See also
constBegin(), end()
bool QString8::contains ( char  ch,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns true if this string contains an occurrence of the character ch, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

bool QString8::contains ( const QRegularExpression8 regExp) const
inline

Returns true if this string contains an occurrence of the regular expression regExp, otherwise it returns false.

QRegularExpression regExp("[0-9]$");
// obsolete syntax, indexIn method removed
bool found_A = regExp.indexIn(child->objectName()) != -1;
// use contains()
bool found_B = child->objectName().contains(regExp);
bool QString8::contains ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if this string contains an occurrence of the string str, otherwise it returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString str = "Peter Pan";
str.contains("peter", Qt::CaseInsensitive); // returns true
See also
indexOf(), count()
bool QString8::contains ( QChar32  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if this string contains an occurrence of the character c, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

bool QString8::contains ( QStringView8  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if this string contains an occurrence of the string view str, otherwise it returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

See also
indexOf(), count()
size_type QString8::count ( ) const
inline

Equivalent to calling size().

size_type QString8::count ( const QRegularExpression8 regExp) const

Returns the number of occurrences of the regular expression regExp in the string.

size_type QString8::count ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns the number of (potentially overlapping) occurrences of the string str in this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

See also
contains(), indexOf()
size_type QString8::count ( QChar32  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns the number of occurrences of character c in the string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

size_type QString8::count ( QStringView8  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns the number of occurrences of the string view str in this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

const_reverse_iterator QString8::crbegin ( ) const
inline

Returns an STL style iterator pointing to the last code point in the string, in reverse order.

See also
begin(), rbegin(), rend()
const_reverse_iterator QString8::crend ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item before the first code point in the string, in reverse order.

See also
end(), rbegin(), rend()
const char * QString8::data ( ) const
inline

Returns a pointer to the null terminated data stored in the string. The pointer is valid until the string is modified.

See also
constData(), operator[]()
bool QString8::empty ( ) const
inline

Returns true if the string has no characters, otherwise returns false.

See also
size()
iterator QString8::end ( )
inline

Returns an STL style iterator pointing to the imaginary item after the last code point in the string.

See also
begin(), constEnd()
const_iterator QString8::end ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item after the last code point in the string.

bool QString8::endsWith ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the string ends with str, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString str = "fruitcake";
str.endsWith("cake"); // returns true
str.endsWith("pie"); // returns false
See also
startsWith()
bool QString8::endsWith ( QChar32  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

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

bool QString8::endsWith ( QStringView8  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the current string ends with the string view str, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString8 & QString8::fill ( QChar32  c,
size_type  numOfChars = -1 
)

Sets every character in the string to character c. If numOfChars is not the default value of -1, the string is resized to the value of numOfChars before the fill is done.

QString str = "San Francisco";
str.fill('z'); // str == "zzzzzzzzzzzzz"
str.fill('A', 2); // str == "AA"
See also
resize()
QChar32 QString8::first ( ) const
inline

Returns the first code point in this string.

See also
back(), at(), operator[]()
template<typename SP = QStringParser, typename... Ts>
QString8 QString8::formatArg ( Ts &&...  args) const
nodiscardinline

Wrapper for QStringParser::formatArg(). In order to use this method in your application include the <QStringParser> header file.

template<typename SP = QStringParser, typename... Ts>
QString8 QString8::formatArgs ( Ts &&...  args) const
nodiscardinline

Wrapper for QStringParser::formatArgs(). In order to use this method in your application include the <QStringParser> header file.

QString8 QString8::fromCFString ( CFStringRef  string)
static

Constructs a new QString containing a copy of the string CFString.

Note
This method is only available on Mac OS X.
QString8 QString8::fromLatin1 ( const char *  str,
size_type  numOfChars = -1 
)
static

Returns a QString8 containing the first numOfChars number of Latin-1 characters specified in str. If value for numOfChars is -1 the entire str is used.

See also
toLatin1(), fromUtf8()
QString8 QString8::fromLatin1 ( const QByteArray str)
static

Returns a QString8 containing the Latin-1 string str.

See also
toLatin1(), fromUtf8()
QString8 QString8::fromNSString ( const NSString *  string)
static

Constructs a new QString containing a copy of the string NSString.

Note
This method is only available on Mac OS X.
QString8 QString8::fromStdString ( const std::string &  str,
size_type  numOfChars = -1 
)
static

Returns a QString8 containing the std::string str.

QString8 QString8::fromStdWString ( const std::wstring &  str,
size_type  numOfChars = -1 
)
static

Returns a QString8 containing the std::wstring str.

QString8 QString8::fromUtf16 ( const char16_t *  str,
size_type  numOfChars = -1 
)
static

Returns a QString8 containing the first numOfChars number of characters from the UTF-16 string str. If the value for numOfChars is -1 the str must be null terminated.

QString8 QString8::fromUtf16 ( const QString16 str)
static

Returns a QString8 containing the UTF-16 string str.

QString8 QString8::fromUtf8 ( const char *  str,
size_type  numOfChars = -1 
)
static

Returns a QString8 containing the first numOfChars number of characters from the C string str. If the value for numOfChars is -1 the str must be null terminated.

See also
toUtf8(), fromLatin1()
QString8 QString8::fromUtf8 ( const char8_t *  str,
size_type  numOfChars = -1 
)
inlinestatic

Returns a QString8 containing the first numOfChars number of characters from the C string str. If the value for numOfChars is -1 the str must be null terminated.

The type char8_t was added in C++20. For more information refer the Using C++20 documentation.

QString8 QString8::fromUtf8 ( const QByteArray str)
static

Returns a QString8 containing the UTF-8 string str.

See also
toUtf8(), fromLatin1()
QChar32 QString8::front ( ) const
inline

Returns the first code point in this string.

See also
back(), at(), operator[]()
size_type QString8::indexOf ( const QRegularExpression8 regExp,
size_type  from = 0 
) const
inline

Returns the index position of the first occurrence of the regular expression regExp in the string, searching forward from the index position from. Returns -1 if regExp is not found.

size_type QString8::indexOf ( const QString8 &  str,
size_type  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the index position of the first occurrence of str in this string. The search begins at position from. Returns -1 if str is not found.

If from is -1 the search starts at the last character, if from is -2 the search starts at the next to last character, and so on. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

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
See also
lastIndexOf(), contains(), count()
size_type QString8::indexOf ( QChar32  c,
size_type  from = 0,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the index position of the first occurrence of the character c in the string, searching forward from index position from. Returns -1 if c is not found.

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

const_iterator QString8::indexOfFast ( const QRegularExpression8 regExp) const
inline

Returns the iterator position of the first occurrence of the regular expression regExp in the string. Returns the end iterator if the regExp is not found.

QString str = "the minimum value";
auto iter = str.indexOfFast(QRegularExpression("m[aeiou]")); // returns an iterator
const_iterator QString8::indexOfFast ( const QRegularExpression8 regExp,
const_iterator  from 
) const

Returns the iterator position of the first occurrence of the string view str in the string, searching forward from iterator position from. Returns the end iterator if str is not found.

const_iterator QString8::indexOfFast ( const QString8 &  str) const
inline

Returns an iterator to the first occurrence of str in this string. Returns the end iterator if str is not found.

const_iterator QString8::indexOfFast ( const QString8 &  str,
const_iterator  from = cbegin(),
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns an iterator to the first occurrence of str in this string, searching forward from iterator from. Returns the end iterator if str is not found.

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

const_iterator QString8::indexOfFast ( QChar32  c) const
inline

Returns an iterator to the first occurrence of c in this string. Returns the end iterator if c is not found.

const_iterator QString8::indexOfFast ( QChar32  c,
const_iterator  from = cbegin(),
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns an iterator to the first occurrence of c in this string, searching forward from iterator from. Returns the end iterator if c is not found.

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

const_iterator QString8::indexOfFast ( QStringView8  str,
const_iterator  from,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the iterator position of the first occurrence of the string view str in the string, searching forward from iterator position from. Returns the end iterator if str is not found.

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

QString8 & QString8::insert ( const_iterator  first,
const QString8 &  str 
)
inline

Beginning at position first in the current string, insert str. Returns a reference to this string.

template<typename Iterator >
QString8 & QString8::insert ( const_iterator  first,
Iterator  begin,
Iterator  end 
)
inline

Beginning at position first in the current string, insert the range of characters from begin to end. Returns a reference to this string.

QString8 & QString8::insert ( size_type  indexStart,
const QChar32 data,
size_type  numOfChars 
)
inline

At position indexStart in the string, insert the first numOfChars number of code points pointed to by data.

QString8 & QString8::insert ( size_type  indexStart,
const QString8 &  str 
)
inline

Inserts the string str at the given indexStart and returns a reference to this string. If the given indexStart is greater than size() the string is first extended using resize().

QString str = "Meal";
str.insert(1, QString("ontr")); // str == "Montreal"
See also
append(), prepend(), replace(), remove()
QString8 & QString8::insert ( size_type  indexStart,
QChar32  c 
)
inline

Inserts c at the given index indexStart in the string.

QString8 & QString8::insert ( size_type  indexStart,
QStringView8  str 
)
inline

Inserts the string view str at the given position indexStart in this string. Returns a reference to this string.

QString8 & QString8::insert ( size_type  indexStart,
QStringView8  str,
size_type  srcStart,
size_type  numOfChars 
)
inline

Inserts the string view str at the given position indexStart in the string, beginning at the position srcStart in str and continuing for the length numOfChars.

Returns a reference to this string.

bool QString8::isEmpty ( ) const
inline

Returns true if the string has no characters, otherwise returns false.

QString().isEmpty(); // returns true
QString("").isEmpty(); // returns true
QString("x").isEmpty(); // returns false
QString("abc").isEmpty(); // returns false
See also
size()
QChar32 QString8::last ( ) const
inline

Returns the last code point in this string.

See also
front(), at(), operator[]()
size_type QString8::lastIndexOf ( const QString8 &  str,
size_type  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. Returns -1 if str is not found.

If from is -1 the search starts at the last character, if from is -2 the search starts at the next to last character, and so on. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

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(), count()
size_type QString8::lastIndexOf ( QChar32  c,
size_type  from = -1,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the index position of the last occurrence of the character c, searching backward from position from. Returns -1 if str is not found.

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

const_iterator QString8::lastIndexOfFast ( const QString8 &  str) const
inline

Returns an iterator to the last occurrence of str in this string. Returns the end iterator if str is not found.

const_iterator QString8::lastIndexOfFast ( const QString8 &  str,
const_iterator  from = cend(),
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns an iterator to the first occurrence of str in this string, searching backward from iterator from. Returns the end iterator if str is not found.

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

const_iterator QString8::lastIndexOfFast ( QChar32  c) const
inline

Returns an iterator to the last occurrence of c in this string. Returns the end iterator if c is not found.

const_iterator QString8::lastIndexOfFast ( QChar32  c,
const_iterator  from = cend(),
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns an iterator to the last occurrence of c in this string, searching backward from iterator from. Returns the end iterator if c is not found.

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

const_iterator QString8::lastIndexOfFast ( QStringView8  str,
const_iterator  from,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const
inline

Returns the iterator position of the last occurrence of the string view str in this string, searching backward from iterator position from. Returns the end iterator if str is not found.

If from is -1 the search starts at the last character, if from is -2 the search starts at the next to last character, and so on. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString8 QString8::left ( size_type  numOfChars) const
nodiscard

Returns a new QString8 containing the first numOfChars code points in this string. The entire string is returned if numOfChars is greater than size() or less than zero.

QString str1 = "Pineapple";
QString str2 = x.left(4); // str1 == "Pine"
See also
leftView(), right(), mid(), startsWith()
QString8 QString8::leftJustified ( size_type  width,
QChar32  fill = UCHAR(' '),
bool  truncate = false 
) const
nodiscard

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 the value of 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, the copy is returned.

QString str = "Pineapple";
str = str.leftJustified(5, '.', true); // str == "Pinea"
See also
rightJustified()
QStringView8 QString8::leftView ( size_type  numOfChars) const
nodiscard

Returns a QStringView8 containing the first numOfChars code points in this string. The entire string is returned if numOfChars is greater than size() or less than zero.

QString str = "Pineapple";
QStringView sv = str.leftRef(4); // sv == "Pine"
See also
rightView(), midView()
size_type QString8::length ( ) const
inline

Returns the number of characters in this string. This method is the same as calling size().

See also
resize()
int QString8::localeAwareCompare ( const QString8 &  str) const
inline

Compares string str with this string object and returns an integer based on the sort relationship of the strings. The comparison is performed platform dependent.

  • if this string is less than str, returns -1
  • if this string is equal to str, returns 0
  • if this string is greater than str, returns 1
int QString8::localeAwareCompare ( const QString8 &  str1,
const QString8 &  str2 
)
inlinestatic

Compares string str1 with string str2 and returns an integer based on the sort relationship of the strings. The comparison is performed platform dependent.

  • if str1 is less than str2, returns -1
  • if str1 is equal to str2, returns 0
  • if str1 is greater than str2, returns 1
int QString8::localeAwareCompare ( QStringView8  str) const
inline

Compares this string with the string view str and returns an integer based on the sort relationship of the strings. The comparison is performed platform dependent.

  • if this string is less than str, returns -1
  • if this string is equal to str, returns 0
  • if this string is greater than str, returns 1
int QString8::localeAwareCompare ( QStringView8  str1,
QStringView8  str2 
)
static

Compares string view str1 with string view str2 and returns an integer based on the sort relationship of the strings. The comparison is performed platform dependent.

  • if str1 is less than str2, returns -1
  • if str1 is equal to str2, returns 0
  • if str1 is greater than str2, returns 1
QString8 QString8::mid ( const_iterator  iter,
size_type  numOfChars = -1 
) const
nodiscard

Returns a string containing numOfChars characters of this string, starting at the iterator position iter.

QString8 QString8::mid ( size_type  indexStart,
size_type  numOfChars = -1 
) const
nodiscard

Returns a string containing numOfChars characters of this string, starting at the position indexStart.

Returns an empty string if the index exceeds the length of the string. If there are less than numOfChars characters available in the string, starting at the given index, or if numOfChars is -1, the method returns all characters available from the specified index to the end of the string.

QString x = "Nine pineapples";
QString y = x.mid(5, 4); // y == "pine"
QString z = x.mid(5); // z == "pineapples"
See also
left(), right()
QStringView8 QString8::midView ( const_iterator  iter,
size_type  numOfChars = -1 
) const

Returns a QStringView8 containing the code points starting at iterator position iter for a length of numOfChars.

QStringView8 QString8::midView ( size_type  indexStart,
size_type  numOfChars = -1 
) const

Returns a QStringView8 containing the code points starting at indexStart for a length of numOfChars.

  • If the position exceeds the length of this string an empty QStringView is returned.
  • The entire string is returned if there are less than numOfChars characters in this string, starting at the given position.
  • The entire string is returned if numOfChars is -1.
QString str = "Nine pineapples";
QStringView sv1 = str.midView(5, 4); // sv1 == "pine"
QStringView sv2 = str.midView(5); // sv2 == "pineapples"
See also
leftView(), rightView()
QString8 QString8::normalized ( QString8::NormalizationForm  mode,
QChar32::UnicodeVersion  version = QChar32::Unicode_Unassigned 
) const
nodiscard

Returns the string in the given Unicode normalization mode, according to the given version of the Unicode standard.

template<typename SP = QStringParser>
QString8 QString8::number ( double  value,
char  format = 'g',
int  precision = 6 
)
nodiscardinlinestatic

Wrapper for QStringParser::number(). In order to use this method in your application include the <QStringParser> header file.

template<typename V , typename SP = QStringParser>
QString8 QString8::number ( value,
int  base = 10 
)
nodiscardinlinestatic

Wrapper for QStringParser::number(). In order to use this method in your application include the <QStringParser> header file.

QString8 & QString8::operator+= ( const QString8 &  other)
inline

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

QString str1 = "free";
QString str2 = "dom";
str1 += str2; // str1 == "freedom"
See also
append(), prepend()
QString8 & QString8::operator+= ( QChar32  c)
inline

Appends c to this string and returns a reference to this string.

QString8 & QString8::operator+= ( QChar32::SpecialCharacter  c)
inline

Appends the special Unicode character c to this string and returns a reference to this string.

QString8 & QString8::operator+= ( QStringView8  str)
inline

Appends the string view str to this string.

QString8 & QString8::operator= ( const QString8 &  other)
default

Copy assigns from other and returns a reference to this object.

QString8 & QString8::operator= ( QChar32  c)
inline

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

QString8 & QString8::operator= ( QString8 &&  other)
default

Move assigns from other and returns a reference to this object.

QString8 & QString8::operator= ( QStringView8  str)
inline

Assigns the string view str to this string and returns a reference to this string.

QChar32 QString8::operator[] ( size_type  index) const
inline

Returns the code point at the specified index in the string. Equivalent to calling at(index).

QString8 & QString8::prepend ( char32_t  c)
inline

Prepends the character c to this string and returns a reference to this string.

QString8 & QString8::prepend ( const QChar32 data,
size_type  numOfChars 
)
inline

Prepends the first numOfChars number of characters pointed to by data.

QString8 & QString8::prepend ( const QString8 &  other)
inline

Prepends the string other to the beginning of this string and returns a reference to this string.

QString x = "ship";
QString y = "air";
x.prepend(y); // x == "airship"
See also
append(), insert()
QString8 & QString8::prepend ( const_iterator  iter_begin,
const_iterator  iter_end 
)
inline

Prepends from iter_begin to iter_end. Returns a reference to this string.

QString8 & QString8::prepend ( QChar32  c)
inline

Prepends the character c to this string and returns a reference to this string.

void QString8::push_back ( const QString8 &  other)
inline

This method is equivalent to appending the given other string onto the end of this string. It is the same as append(other).

See also
append()
void QString8::push_back ( QChar32  c)
inline

Appends the given c character to the end of this string.

void QString8::push_front ( const QString8 &  other)
inline

This method is equivalent to prepending the given other string to the beginning of this string. It is the same as prepend(other).

See also
prepend()
void QString8::push_front ( QChar32  c)
inline

Prepends the given c character to the beginning of this string.

reverse_iterator QString8::rbegin ( )
inline

Returns an STL style iterator pointing to the last code point in the string, in reverse order.

See also
begin(), crbegin(), rend()
const_reverse_iterator QString8::rbegin ( ) const
inline

Returns a const STL style iterator pointing to the last code point in the string, in reverse order.

QString8 & QString8::remove ( const QRegularExpression8 regExp)
inline

Removes every occurrence of the regular expression regExp in the string and returns a reference to the string.

QString str = "trombone";
str.remove(QRegularExpression("[aeiou].")); // str == "trbe"
See also
indexOf(), lastIndexOf(), replace()
QString8 & QString8::remove ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Removes every occurrence of the given str in this string and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

This is the same as replace(str, "", cs).

See also
replace()
QString8 & QString8::remove ( QChar32  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Removes every occurrence of the character c in this string, and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString str = "Ali Baba";
str.remove(QChar('a'), Qt::CaseInsensitive); // str == "li Bb"

This is the same as replace(c, "", cs).

See also
replace()
QString8 & QString8::remove ( size_type  indexStart,
size_type  numOfChars 
)

Removes numOfChars code points from the string, starting at the given indexStart index. Returns a reference to the string. If (indexStart + numOfChars) is beyond the end of the string, the string is truncated at the specified indexStart.

QString str = "Montreal";
str.remove(1, 4); // str == "Meal"
See also
insert(), replace()
reverse_iterator QString8::rend ( )
inline

Returns an STL style iterator pointing to the imaginary item before the first code point in the string, in reverse order.

See also
begin(), crbegin(), rend()
const_reverse_iterator QString8::rend ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item before the first code point in the string, in reverse order.

QString8 QString8::repeated ( size_type  count) const
nodiscard

Returns a copy of this string repeated the specified number of count. If the value for times is less than 1, an empty string is returned.

QString str("ab");
return str.repeated(4); // returns "abababab"
QString8 & QString8::replace ( const QChar32 before,
size_type  beforeSize,
const QChar32 after,
size_type  afterSize,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Replaces each occurrence in this string of the first beforeSize characters of before with the first afterSize characters of after and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString8 & QString8::replace ( const QRegularExpression8 regExp,
const QString8 &  after 
)

Replaces every occurrence of the regular expression regExp in the string with after. Returns a reference to the string.

QString str = "banana";
str.replace(QRegularExpression("a[mn]"), "ox"); // str == "boxoxa"

For regular expressions containing capturing parentheses in the pattern, occurrences of \1, \2, ..., in the passed parameter string "after" are replaced with the corresponding capture.

QString str = "half a <i>banana</i>";
str.replace(QRegularExpression("<i>([^<]*)</i>"), "\\emph{\\1}"); // str == "half a \\emph{banana}"
See also
indexOf(), lastIndexOf(), remove(), QRegularExpressionMatch::captured()
QString8 & QString8::replace ( const QString8 &  before,
const QString8 &  after,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Replaces every occurrence of the string before with the string after and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString str = "colour behavior flavour neighbour";
str.replace(QString("ou"), QString("o")); // str == "color behavior flavor neighbor"

It is of value to note the replacement text is not rescanned after it is inserted.

QString str = "xxxxxx";
str.replace("xx", "x"); // str == "xxx"
QString8 & QString8::replace ( const_iterator  first,
const_iterator  last,
const QString8 &  str 
)
inline

Beginning at position first replace the characters up to but not including last with str. Returns a reference to this string.

template<typename Iterator >
QString8 & QString8::replace ( const_iterator  first1,
const_iterator  last1,
Iterator  first2,
Iterator  last2 
)
inline

Replace the range from first1 to last1 with the characters from first2 to last2. Returns a reference to this string.

QString8 & QString8::replace ( QChar32  before,
QChar32  after,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Replaces every occurrence of the QChar32 before with the QChar32 after and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString8 & QString8::replace ( QChar32  c,
const QString8 &  after,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)

Replaces every occurrence of the QChar32 c in this string with the string after and returns a reference to this string. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

QString8 & QString8::replace ( size_type  indexStart,
size_type  numOfChars,
const QChar32 data,
size_type  sizeStr 
)
inline

Beginning at position indexStart in this string, replace the next numOfChars with the first sizeStr code points of data. Returns a reference to this string.

QString8 & QString8::replace ( size_type  indexStart,
size_type  numOfChars,
const QString8 &  str 
)
inline

Beginning at position indexStart in this string, replace the next numOfChars with string str. Returns a reference to this string.

QString x = "Say yes";
QString y = "no";
x.replace(4, 3, y); // x == "Say no"
See also
insert(), remove()
QString8 & QString8::replace ( size_type  indexStart,
size_type  numOfChars,
const QString8 &  str,
size_type  sizeStr 
)
inline

Beginning at position indexStart in this string, replace the next numOfChars with the first sizeStr number of code points from the string str. Returns a reference to this string.

QString8 & QString8::replace ( size_type  indexStart,
size_type  numOfChars,
QChar32  c 
)
inline

Beginning at position indexStart in this string, replace the next numOfChars with a single character c. Returns a reference to this string.

void QString8::resize ( size_type  numOfChars)
inline

Sets the size of the string to numOfChars code points. If numOfChars is greater than the current size the string is extended to make it numOfChars code points long with the extra code points added to the end. The new code points are uninitialized.

If numOfChars is less than the current size, characters are removed from the end.

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 code points to the string, use operator+=() as follows rather than resize().

QString t = "Hello";
t += QString(10, 'X'); // t == "HelloXXXXXXXXXX"

If you want to expand the string so that it reaches a certain width and fill the new positions with a particular code point, use the leftJustified() method:

If size is negative, it is equivalent to passing zero.

QString r = "Hello";
r = r.leftJustified(10, ' '); // r == "Hello "
See also
truncate()
void QString8::resize ( size_type  numOfChars,
QChar32  c 
)
inline

Sets the size of the string to numOfChars code points. If numOfChars is greater than the current size the string is extended to make it numOfChars characters long with the extra code points added to the end.

The new code points are initialized to c.

QString8 QString8::right ( size_type  count) const
nodiscard

Returns a substring containing the count rightmost code points of the string. The entire string is returned if count is greater than size() or less than zero.

QString x = "Pineapple";
QString y = x.right(5); // y == "apple"
See also
left(), mid(), endsWith()
QString8 QString8::rightJustified ( size_type  width,
QChar32  fill = UCHAR(' '),
bool  truncate = false 
) const
nodiscard

Returns a string of size() width that contains the fill character followed by the string.

If truncate is false and the size() of the string is more than the width, the returned string is a copy of the string.

QString s = "apple";
QString t = s.rightJustified(8, '.'); // t == "...apple"

If truncate is true and the size() of the string is more than width, the resulting string is truncated at position width.

QString str = "Grapefruit";
str = str.rightJustified(5, '.', true); // str == "Grape"
See also
leftJustified()
QStringView8 QString8::rightView ( size_type  count) const
nodiscard

Returns a QStringView8 containing the last count code points in this string. The entire string is returned if numOfChars is greater than size() or less than zero.

QString str = "Pineapple";
QStringView sv = str.rightView(5); // y == "apple"
See also
leftView(), midView()
template<typename SP = QStringParser, typename... Ts>
QString8 QString8::section ( const QString8 &  separator,
Ts...  args 
) const
inline

Wrapper for QStringParser::section(). In order to use this method in your application include the <QStringParser> header file.

template<typename SP = QStringParser, typename... Ts>
QString8 QString8::section ( QChar32  separator,
Ts...  args 
) const
inline

Wrapper for QStringParser::section(). In order to use this method in your application include the <QStringParser> header file.

QString str;
QString csv = "firstName,middleName,lastName,phone";
str = csv.section(',', 2, 2); // str == "lastName"
QString8 QString8::simplified ( ) &&
nodiscard

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. This method is only called if this string is an rvalue, this occurs when the string is a temporary or has been moved.

Refer to the const reference version of simplified().

QString8 QString8::simplified ( ) const &
nodiscard

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 QChar32::isSpace() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.

QString str = " lots\t of\n whitespace\r\n ";
str = str.simplified(); // str == "lots of whitespace";
See also
trimmed()
size_type QString8::size ( ) const
inline

Returns the number of code points in this string.

The last character in the string is at position size() - 1. In addition, QString8 ensures the character at position size() is always '\0' so you can use the return value of data() and constData() as arguments to functions which expect null terminated strings.

QString str = "CopperSpice";
int len = str.size(); // len == 11
str.data()[0]; // returns 'C'
str.data()[4]; // returns 'e'
str.data()[11]; // returns '\0'
See also
isEmpty(), resize()
size_type QString8::size_storage ( ) const
inline

Returns the number of storage units in this string. The storage size is the actual bytes required in the underlying container for a string. This value will usually be larger than size().

It is normally only used when passing a QString8 to a C API which expects a pointer and a length.

template<typename SP = QStringParser, typename... Ts>
QList< QString8 > QString8::split ( const QRegularExpression separator,
Ts...  args 
) const
inline

Wrapper for QStringParser::split(). In order to use this method in your application include the <QStringParser> header file.

template<typename SP = QStringParser, typename... Ts>
QList< QString8 > QString8::split ( const QString8 &  separator,
Ts...  args 
) const
inline

Wrapper for QStringParser::split(). In order to use this method in your application include the <QStringParser> header file.

template<typename SP = QStringParser, typename... Ts>
QList< QString8 > QString8::split ( QChar32  separator,
Ts...  args 
) const
inline

Wrapper for QStringParser::split(). In order to use this method in your application include the <QStringParser> header file.

void QString8::squeeze ( )
inline

Releases any memory not required to store the character data. In general you will rarely ever need to call this method.

bool QString8::startsWith ( const QString8 &  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the current string starts with str, otherwise returns false. If cs is Qt::CaseSensitive 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()
bool QString8::startsWith ( QChar32  c,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the string starts with c, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

bool QString8::startsWith ( QStringView8  str,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
) const

Returns true if the current string starts with the string view str, otherwise returns false. If cs is Qt::CaseSensitive the search is case sensitive, otherwise the search is case insensitive.

const_storage_iterator QString8::storage_begin ( ) const
inline

Returns a const STL style iterator pointing to the first storage unit in the string. In UTF-8 a code point such as the Greek letter Delta is one code point and requires two storage units.

See also
size_storage()
const_storage_iterator QString8::storage_end ( ) const
inline

Returns a const STL style iterator pointing to the imaginary item after the last storage unit in the string.

See also
size_storage()
const_storage_reverse_iterator QString8::storage_rbegin ( ) const
inline

Returns a const STL style iterator pointing to the last storage unit in the string, in reverse order.

See also
size_storage()
const_storage_reverse_iterator QString8::storage_rend ( ) const
inline

Returns a const STL style iterator pointing to one before the first storage unit in the string, in reverse order.

See also
size_storage()
void QString8::swap ( QString8 &  other)
inline

Swaps other with this object. This operation is very fast and never fails.

QString8 QString8::toCaseFolded ( ) &&
nodiscard

Converts the string to case folded and returns the converted string. This method is only called if this string is an rvalue, this occurs when the string is a temporary or has been moved.

Refer to the const reference version of toCaseFolded().

QString8 QString8::toCaseFolded ( ) const &
nodiscard

Returns the case folded equivalent of the string. For most Unicode characters this is the same as toLower().

CFStringRef QString8::toCFString ( ) const

Creates a CFString from a QString. The caller owns the CFString and is responsible for releasing it.

Note
This method is only available on Mac OS X.
template<typename SP = QStringParser>
double QString8::toDouble ( bool *  ok = nullptr) const
inline

Wrapper for QStringParser::toDouble(). In order to use this method in your application include the <QStringParser> header file.

template<typename SP = QStringParser>
float QString8::toFloat ( bool *  ok = nullptr) const
inline

Wrapper for QStringParser::toFloat(). In order to use this method in your application include the <QStringParser> header file.

QString8 QString8::toHtmlEscaped ( ) const

Converts a plain text string to an HTML string with HTML meta characters <, >, &, and " replaced by HTML entities.

QString plain = "#include <QStringView>";
QString html = plain.toHtmlEscaped(); // html == "#include &lt;QStringView&gt;"
Note
This method replaces Qt::escape ( const QString & plain )
template<typename R , typename SP = QStringParser>
R QString8::toInteger ( bool *  ok = nullptr,
int  base = 10 
) const
inline

Wrapper for QStringParser::toInteger(). In order to use this method in your application include the <QStringParser> header file.

This method replaces the following set of methods: toInt, toUInt, toLong, toULong, toLongLong, toULongLong, toShort, toUShort. The required data type is passed as the template parameter to this method. The following example shows how to specify long as the type argument.

QString str = "45";
long value = str.toInteger<long>(); // value == 45
QByteArray QString8::toLatin1 ( ) const
nodiscard

Returns a Latin-1 representation of the string as a QByteArray. All code points which can not be represented in Latin-1 will be replaced with a question mark.

See also
fromLatin1(), toUtf8()
QString8 QString8::toLower ( ) &&
nodiscard

Converts the string to lowercase and returns the converted string. This method is only called if this string is an rvalue, this occurs when the string is a temporary or has been moved.

Refer to the const reference version of toLower().

QString8 QString8::toLower ( ) const &
nodiscard

Returns a lowercase copy of the string.

QString str = "CopperSpice";
str = str.toLower(); // str == "copperspice"

The case conversion will always happen in the 'C' locale. For locale dependent lower casing use QLocale::toLower().

See also
toUpper(), QLocale::toLower()
NSString * QString8::toNSString ( ) const

Creates a NSString from a QString. The NSString is autoreleased.

Note
This method is only available on Mac OS X.
std::string QString8::toStdString ( ) const
inline

Returns this string as an std::string encoded in UTF-8.

std::wstring QString8::toStdWString ( ) const

Returns this string as an std::wstring encoded in UTF-8.

QString8 QString8::toUpper ( ) &&
nodiscard

Converts the string to uppercase and returns the converted string. This method is only called if this string is an rvalue, this occurs when the string is a temporary or has been moved.

Refer to the const reference version of toUpper().

QString8 QString8::toUpper ( ) const &
nodiscard

Returns an uppercase copy of the string.

QString str = "CopperSpice";
str = str.toUpper(); // str == "COPPERSPICE"

The case conversion will always happen in the 'C' locale. For locale dependent upper casing use QLocale::toUpper().

See also
toLower(), QLocale::toUpper()
QString16 QString8::toUtf16 ( ) const
nodiscard

Returns this string as a QString16.

QByteArray QString8::toUtf8 ( ) const
nodiscard

Returns this string as a QByteArray.

See also
fromUtf8(), toLatin1()
QString8 QString8::trimmed ( ) &&
nodiscard

Trims the string and returns the trimmed string. This method is only called if this string is an rvalue, this occurs when the string is a temporary or has been moved.

Refer to the const reference version of the method trimmed().

QString8 QString8::trimmed ( ) const &
nodiscard

Returns a string that has whitespace removed from the start and the end. Whitespace means any character for which QChar32::isSpace() returns true. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.

QString str = " lots\t of\n whitespace\r\n ";
str = str.trimmed(); // str == "lots\t of\n whitespace"

Unlike simplified(), trimmed() leaves internal whitespace alone.

See also
simplified()
void QString8::truncate ( size_type  length)

Removes code points from length to the end of the string. If the specified length is beyond the end of the string, nothing happens. If length is negative it is equivalent to passing zero.

QString str = "CopperSpice";
str.truncate(6); // str == "Copper"
See also
chop(), resize(), left()
const uint8_t * QString8::utf8 ( ) const
inline

Returns a pointer to the null terminated data stored in the string. The pointer is valid until the string is modified.

See also
data(), constData(), operator[]()

Friends And Related Function Documentation

bool operator!= ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is not equal to the string str, otherwise returns false.

bool operator!= ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if the string str is not equal to the C string cString, otherwise returns false.

bool operator!= ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if str1 is not equal to string str2, otherwise returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

QString8 operator+ ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns a string which is the result of concatenating string literal cString and the string str.

QString8 operator+ ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns a string which is the result of concatenating str and the string literal cString.

QString8 operator+ ( const QString8 &  str,
QChar32  c 
)
related

Returns a string which is the result of concatenating the string str and the character c.

QString8 operator+ ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns a string which is the result of concatenating str1 and str2.

QString8 operator+ ( QChar32  c,
const QString8 &  str 
)
related

Returns a string which is the result of concatenating the character c and the string str.

QString8 && operator+ ( QString8 &&  str,
const char (&)  cString[N] 
)
related

Returns a string which is the result of concatenating str and the string literal cString. This method is only called if the string is an rvalue, this occurs when the string is a temporary or has been moved.

QString8 && operator+ ( QString8 &&  str,
QChar32  c 
)
related

Returns a string which is the result of concatenating the string str and the character c. This method is only called if the string is an rvalue, this occurs when the string is a temporary or has been moved.

QString8 && operator+ ( QString8 &&  str1,
const QString8 &  str2 
)
related

Returns a string which is the result of concatenating str1 and str2. This method is only called if str1 is an rvalue, this occurs when the string is a temporary or has been moved.

bool operator< ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is lexically less than string str, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator< ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if the string str is lexically less than C string cString, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator< ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if the string str1 is lexically less than string str2, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

QDataStream & operator<< ( QDataStream stream,
const QString8 &  str 
)
related

Writes the given str to the stream. Returns a reference to the stream.

Refer to Serializing Data Types for additional information.

bool operator<= ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is lexically less than or equal to than string str, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator<= ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if the string str is lexically less than or equal to than C string cString, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator<= ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if the string str1 is lexically less than or equal to than string str2, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator== ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is equal to string str, otherwise returns false.

bool operator== ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if string str is equal to the C string cString, otherwise returns false.

bool operator== ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if string str1 is equal to str2, otherwise returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator> ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is lexically greater than string str, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator> ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if the string str is lexically greater than C string cString, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator> ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if the string str1 is lexically greater than string str2, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator>= ( const char (&)  cString[N],
const QString8 &  str 
)
related

Returns true if the C string cString is lexically greater than or equal to than string str, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator>= ( const QString8 &  str,
const char (&)  cString[N] 
)
related

Returns true if the string str is lexically greater than or equal to than C string cString, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

bool operator>= ( const QString8 &  str1,
const QString8 &  str2 
)
related

Returns true if the string str1 is lexically greater than or equal to than string str2, otherwise it returns false.

The comparison is based exclusively on the numeric Unicode values of the code points and is very fast, but may not be what a person would expect.

QDataStream & operator>> ( QDataStream stream,
QString8 &  str 
)
related

Reads from the stream into the given str. Returns a reference to the stream.

Refer to Serializing Data Types for additional information.

QString ( )
related

Typedef for QString8.

void swap ( QString8 &  str1,
QString8 &  str2 
)
related

Swaps string str1 with str2. This operation is very fast and never fails.