10#if defined(QT_NO_CAST_FROM_ASCII) && defined(QT_RESTRICTED_CAST_FROM_ASCII)
11#error QT_NO_CAST_FROM_ASCII and QT_RESTRICTED_CAST_FROM_ASCII must not be defined at the same time
14#include <QtCore/qchar.h>
15#include <QtCore/qbytearray.h>
16#include <QtCore/qbytearrayview.h>
17#include <QtCore/qarraydata.h>
18#include <QtCore/qlatin1stringview.h>
19#include <QtCore/qnamespace.h>
20#include <QtCore/qstringliteral.h>
21#include <QtCore/qstringalgorithms.h>
22#include <QtCore/qanystringview.h>
23#include <QtCore/qstringtokenizer.h>
27#include <QtCore/q20memory.h>
32#error qstring.h must be included before any header file that defines truncate
35#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
51template <
typename Char>
53 std::is_same<Char, char32_t>;
54template <
typename Char>
101template <
typename Visitor>
105 return std::forward<Visitor>(
v)(asStringView());
107 return std::forward<Visitor>(
v)(asLatin1StringView());
109 return std::forward<Visitor>(
v)(asUtf8StringView());
118 return visit([] (
auto that) {
return QAnyStringView::toQChar(that.front()); });
122 return visit([] (
auto that) {
return QAnyStringView::toQChar(that.back()); });
130 friend class ::tst_QString;
132 template <
typename Iterator>
133 static constexpr bool is_contiguous_iterator_v =
138 std::is_pointer_v<Iterator>;
140 template <
typename Char>
141 using is_compatible_char_helper = std::disjunction<
144 std::is_same<Char, QLatin1Char>
147 template <
typename Iterator>
148 static constexpr bool is_compatible_iterator_v = std::conjunction_v<
150 typename std::iterator_traits<Iterator>::iterator_category,
151 std::input_iterator_tag
153 is_compatible_char_helper<typename std::iterator_traits<Iterator>::value_type>
156 template <
typename Iterator>
157 using if_compatible_iterator = std::enable_if_t<is_compatible_iterator_v<Iterator>,
bool>;
162 inline constexpr QString() noexcept;
167#if defined(__cpp_char8_t) || defined(Q_QDOC)
180 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(
QString)
183#if QT_DEPRECATED_SINCE(6, 4)
188 inline bool isEmpty()
const;
198 inline void squeeze();
200 inline const QChar *unicode()
const;
203 inline const QChar *constData()
const;
205 inline void detach();
206 inline bool isDetached()
const;
215 [[nodiscard]]
inline QChar &front();
217 [[nodiscard]]
inline QChar &back();
220 QChar fillChar = u
' ')
const;
222 QChar fillChar = u
' ')
const;
224 QChar fillChar = u
' ')
const;
226 QChar fillChar = u
' ')
const;
228 QChar fillChar = u
' ')
const;
230 QChar fillChar = u
' ')
const;
232 QChar fillChar = u
' ')
const;
234 QChar fillChar = u
' ')
const;
236 QChar fillChar = u
' ')
const;
237 [[nodiscard]]
QString arg(
char a,
int fieldWidth = 0,
238 QChar fillChar = u
' ')
const;
240 QChar fillChar = u
' ')
const;
242 QChar fillChar = u
' ')
const;
244 QChar fillChar = u
' ')
const;
246 QChar fillChar = u
' ')
const;
248 template <
typename T>
249 using is_convertible_to_view_or_qstring = std::disjunction<
250 std::is_convertible<T, QString>,
251 std::is_convertible<T, QStringView>,
252 std::is_convertible<T, QLatin1StringView>
255 template <
typename...Args>
260 typename std::enable_if<
261 sizeof...(Args) >= 2 && std::is_same<
302#if QT_CONFIG(regularexpression)
309 template <
typename T = QRegularExpressionMatch, std::enable_if_t<std::is_same_v<T, QRegularExpressionMatch>,
bool> = false>
320 SectionDefault = 0x00,
321 SectionSkipEmpty = 0x01,
322 SectionIncludeLeadingSep = 0x02,
323 SectionIncludeTrailingSep = 0x04,
324 SectionCaseInsensitiveSeps = 0x08
330#if QT_CONFIG(regularexpression)
361 bool isUpper()
const;
362 bool isLower()
const;
369 {
return toLower_helper(*
this); }
371 {
return toLower_helper(*
this); }
373 {
return toUpper_helper(*
this); }
375 {
return toUpper_helper(*
this); }
377 {
return toCaseFolded_helper(*
this); }
379 {
return toCaseFolded_helper(*
this); }
381 {
return trimmed_helper(*
this); }
383 {
return trimmed_helper(*
this); }
385 {
return simplified_helper(*
this); }
387 {
return simplified_helper(*
this); }
389 [[nodiscard]]
QString toLower()
const;
390 [[nodiscard]]
QString toUpper()
const;
391 [[nodiscard]]
QString toCaseFolded()
const;
392 [[nodiscard]]
QString trimmed()
const;
393 [[nodiscard]]
QString simplified()
const;
395 [[nodiscard]]
QString toHtmlEscaped()
const;
424 template <
typename InputIterator, if_compatible_iterator<InputIterator> = true>
427 using V =
typename std::iterator_traits<InputIterator>::value_type;
428 constexpr bool IsL1C = std::is_same_v<std::remove_cv_t<V>,
QLatin1Char>;
429 constexpr bool IsFwdIt = std::is_convertible_v<
430 typename std::iterator_traits<InputIterator>::iterator_category,
431 std::forward_iterator_tag
434 if constexpr (is_contiguous_iterator_v<InputIterator>) {
439 else if constexpr (
sizeof(V) == 4)
440 return assign_helper(
p,
len);
443 }
else if constexpr (
sizeof(V) == 4) {
445 if constexpr (IsFwdIt) {
446 const qsizetype requiredCapacity = 2 * std::distance(
first, last);
449 while (
first != last) {
455 d.assign(
first, last, [](
QChar ch) ->
char16_t {
return ch.unicode(); });
456 d.data()[
d.size] = u
'\0';
468#if defined(QT_RESTRICTED_CAST_FROM_ASCII)
469 template <qsizetype N>
471 template <qsizetype N>
473 template <qsizetype N>
475 template <qsizetype N>
489 template <
typename Predicate>
492 removeIf_helper(pred);
508#if QT_CONFIG(regularexpression)
511 {
return replace(re,
QString()); }
521#ifndef QT_NO_REGULAREXPRESSION
527 template <
typename Needle,
typename...Flags>
533 template <
typename Needle,
typename...Flags>
537 {
return qTokenize(std::move(*
this), std::forward<Needle>(needle),
flags...); }
539 template <
typename Needle,
typename...Flags>
541 noexcept(
noexcept(
qTokenize(std::declval<QString>(), std::forward<Needle>(needle),
flags...)))
542 ->
decltype(
qTokenize(std::move(*
this), std::forward<Needle>(needle),
flags...))
543 {
return qTokenize(std::move(*
this), std::forward<Needle>(needle),
flags...); }
556 const ushort *utf16()
const;
560 {
return toLatin1_helper(*
this); }
562 {
return toLatin1_helper_inplace(*
this); }
564 {
return toUtf8_helper(*
this); }
566 {
return toUtf8_helper(*
this); }
568 {
return toLocal8Bit_helper(isNull() ?
nullptr : constData(),
size()); }
570 {
return toLocal8Bit_helper(isNull() ?
nullptr : constData(),
size()); }
593#if defined(__cpp_char8_t) || defined(Q_QDOC)
595 static inline QString fromUtf8(
const char8_t *
str)
596 {
return fromUtf8(
reinterpret_cast<const char *
>(
str)); }
612#if QT_DEPRECATED_SINCE(6, 0)
618 {
return fromUcs4(
reinterpret_cast<const char32_t *
>(
str),
size); }
636 {
return s1.compare(
s2, cs); }
640 {
return s1.compare(
s2, cs); }
643 {
return -
s2.compare(
s1, cs); }
645 {
return s1.compare(
s2, cs); }
647 {
return -
s2.compare(
s1, cs); }
649 int localeAwareCompare(
const QString&
s)
const;
652 {
return s1.localeAwareCompare(
s2); }
657 {
return toIntegral_helper<short>(*
this,
ok,
base); }
659 {
return toIntegral_helper<ushort>(*
this,
ok,
base); }
661 {
return toIntegral_helper<int>(*
this,
ok,
base); }
663 {
return toIntegral_helper<uint>(*
this,
ok,
base); }
665 {
return toIntegral_helper<long>(*
this,
ok,
base); }
667 {
return toIntegral_helper<ulong>(*
this,
ok,
base); }
668 QT_CORE_INLINE_SINCE(6, 5)
670 QT_CORE_INLINE_SINCE(6, 5)
672 float toFloat(
bool *
ok=
nullptr) const;
750 {
return rhs.size() == 1 && lhs == rhs.front(); }
752 {
return compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; }
754 {
return compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; }
768#if defined(QT_RESTRICTED_CAST_FROM_ASCII)
769 template <qsizetype N>
773 template <qsizetype N>
775 template <qsizetype N>
776 inline QString &operator=(
const char (&
ch)[N])
778 template <qsizetype N>
779 QString &operator=(
char (&)[N]) =
delete;
781#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
789 {
return (*
this = fromUtf8(
ch)); }
791 {
return (*
this = fromUtf8(
a)); }
826 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) == 0; }
828 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) != 0; }
830 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) > 0; }
832 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) < 0; }
834 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) >= 0; }
836 {
return QString::compare_helper(
s2.constData(),
s2.size(),
s1, -1) <= 0; }
873 iterator
erase(const_iterator
first, const_iterator last);
876 static inline QString fromStdString(
const std::string &
s);
877 inline std::string toStdString()
const;
878 static inline QString fromStdWString(
const std::wstring &
s);
879 inline std::wstring toStdWString()
const;
881 static inline QString fromStdU16String(
const std::u16string &
s);
882 inline std::u16string toStdU16String()
const;
883 static inline QString fromStdU32String(
const std::u32string &
s);
884 inline std::u32string toStdU32String()
const;
886#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
887 static QString fromCFString(CFStringRef
string);
889 static
QString fromNSString(const NSString *
string);
893#if defined(Q_OS_WASM) || defined(Q_QDOC)
894 static QString fromJsString(emscripten::val jsString);
895 emscripten::val toJsString()
const;
898 inline bool isNull()
const {
return d->isNull(); }
901 bool isSimpleText()
const;
902 bool isRightToLeft()
const;
910#if defined(QT_NO_CAST_FROM_ASCII)
920 static const char16_t _empty;
932 static int localeAwareCompare_helper(
const QChar *data1,
qsizetype length1,
948#if QT_CORE_REMOVED_SINCE(6, 6)
954 template <
typename Predicate>
955 qsizetype removeIf_helper(Predicate pred)
959 d.data()[
d.size] = u
'\0';
969 template <
typename T>
static
973 using Int32 =
typename std::conditional<std::is_unsigned<T>::value,
uint,
int>
::type;
1018{
return QString::toIntegral_helper<qint64>(*
this,
ok,
base); }
1020{
return QString::toIntegral_helper<quint64>(*
this,
ok,
base); }
1022{
return QString::toIntegral_helper<long>(*
this,
ok,
base); }
1024{
return QString::toIntegral_helper<ulong>(*
this,
ok,
base); }
1026{
return QString::toIntegral_helper<int>(*
this,
ok,
base); }
1028{
return QString::toIntegral_helper<uint>(*
this,
ok,
base); }
1030{
return QString::toIntegral_helper<short>(*
this,
ok,
base); }
1032{
return QString::toIntegral_helper<ushort>(*
this,
ok,
base); }
1038template <
bool UseChar8T>
1049template <
bool UseChar8T>
1055template<
bool UseChar8T>
1084{
return d.size == 0; }
1089#if QT5_NULL_STRINGS == 1
1090 return reinterpret_cast<const QChar *
>(
d.data() ?
d.data() : &_empty);
1092 return reinterpret_cast<const QChar *
>(
d.data());
1099 return reinterpret_cast<QChar *
>(
d.data());
1106{
return !
d->isShared(); }
1125{
return setNum(
double(
n),
f,prec); }
1153 if (
sizeof(
wchar_t) ==
sizeof(
QChar)) {
1158 return QString::toUcs4_helper(
utf16(),
size(),
reinterpret_cast<char32_t *
>(
array));
1166 return sizeof(wchar_t) ==
sizeof(
QChar) ?
fromUtf16(
reinterpret_cast<const char16_t *
>(
string),
size)
1167 :
fromUcs4(
reinterpret_cast<const char32_t *
>(
string),
size);
1175 if (
d->needsDetach() || asize >=
capacity() -
d.freeSpaceAtBegin())
1177 if (
d->constAllocatedCapacity())
1187 if (
d->constAllocatedCapacity())
1198{
detach();
return reinterpret_cast<QChar*
>(
d.data()); }
1200{
return reinterpret_cast<const QChar*
>(
d.data()); }
1202{
return reinterpret_cast<const QChar*
>(
d.data()); }
1204{
return reinterpret_cast<const QChar*
>(
d.data()); }
1206{
detach();
return reinterpret_cast<QChar*
>(
d.data() +
d.size); }
1208{
return reinterpret_cast<const QChar*
>(
d.data() +
d.size); }
1210{
return reinterpret_cast<const QChar*
>(
d.data() +
d.size); }
1212{
return reinterpret_cast<const QChar*
>(
d.data() +
d.size); }
1222#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1224{
return QString::compare_helper(
constData(),
size(),
s, -1) == 0; }
1226{
return QString::compare_helper(
constData(),
size(),
s, -1) != 0; }
1228{
return QString::compare_helper(
constData(),
size(),
s, -1) < 0; }
1230{
return QString::compare_helper(
constData(),
size(),
s, -1) > 0; }
1232{
return QString::compare_helper(
constData(),
size(),
s, -1) <= 0; }
1234{
return QString::compare_helper(
constData(),
size(),
s, -1) >= 0; }
1266{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) == 0; }
1268{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) != 0; }
1270{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) < 0; }
1272{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) > 0; }
1274{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) <= 0; }
1276{
return QString::compare_helper(
constData(),
size(),
s.constData(),
s.size()) >= 0; }
1279{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) == 0; }
1281{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) != 0; }
1283{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) > 0; }
1285{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) < 0; }
1287{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) >= 0; }
1289{
return QString::compare_helper(
s.constData(),
s.size(),
constData(),
size()) <= 0; }
1292#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
1296{
return std::move(lhs += rhs); }
1300{
return std::move(lhs += rhs); }
1303# if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
1340{
return std::u16string(
reinterpret_cast<const char16_t*
>(
data()),
size()); }
1347 std::u32string u32str(
size(),
char32_t(0));
1348 const qsizetype len = toUcs4_helper(
reinterpret_cast<const char16_t *
>(
data()),
1349 size(), u32str.data());
1354#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
1363{
return -
s.compare(*
this, cs); }
1366{
return localeAwareCompare_helper(
constData(),
size(),
s.constData(),
s.size()); }
1368{
return localeAwareCompare_helper(
s1.constData(),
s1.size(),
s2.constData(),
s2.size()); }
1372#if QT_CORE_INLINE_IMPL_SINCE(6, 5)
1375 return toIntegral_helper<qlonglong>(*
this,
ok,
base);
1380 return toIntegral_helper<qulonglong>(*
this,
ok,
base);
1391# define qPrintable(string) QtPrivate::asString(string).toLocal8Bit().constData()
1394#ifndef qUtf8Printable
1395# define qUtf8Printable(string) QtPrivate::asString(string).toUtf8().constData()
1402#ifndef qUtf16Printable
1403# define qUtf16Printable(string) \
1404 static_cast<const wchar_t*>(static_cast<const void*>(QtPrivate::asString(string).utf16()))
1432template <
typename StringView,
typename...Args>
1446template <
typename...Args>
1453template <
typename...Args>
1460template <
typename T>
1463 return s.removeIf_helper([&
t](
const auto &
e) {
return t ==
e; });
1466template <
typename Predicate>
1469 return s.removeIf_helper(pred);
1473inline namespace Literals {
1474inline namespace StringLiterals {
1485#if QT_DEPRECATED_SINCE(6, 8)
1488inline
QString operator"" _qs(const
char16_t *
str,
size_t size) noexcept
1490 return Qt::StringLiterals::operator
""_s(
str,
size);
1498#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
1499#include <QtCore/qstringbuilder.h>
1502#ifdef Q_L1S_VIEW_IS_PRIMARY
1503# undef Q_L1S_VIEW_IS_PRIMARY
constexpr QAnyStringView() noexcept
Constructs a null string view.
constexpr QChar back() const
Returns the last character in the string view.
QString toString() const
Returns a deep copy of this string view's data as a QString.
constexpr QChar front() const
Returns the first character in the string view.
constexpr decltype(auto) visit(Visitor &&v) const
Calls v with either a QUtf8StringView, QLatin1String, or QStringView, depending on the encoding of th...
int compare(QBasicUtf8StringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
std::string toStdString() const
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
friend bool operator<=(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator>=(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator<(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator!=(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator>(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
static constexpr auto fromUcs4(char32_t c) noexcept
UnicodeVersion
Specifies which version of the \l{Unicode standard} introduced a certain character.
\inmodule QtCore\reentrant
friend bool operator<=(QLatin1StringView s1, QLatin1StringView s2) noexcept
constexpr const char * data() const noexcept
friend bool operator>=(QLatin1StringView s1, QLatin1StringView s2) noexcept
int compare(QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator>(QLatin1StringView s1, QLatin1StringView s2) noexcept
friend bool operator!=(QLatin1StringView s1, QLatin1StringView s2) noexcept
friend bool operator==(QLatin1StringView s1, QLatin1StringView s2) noexcept
QString arg(Args &&...args) const
constexpr qsizetype size() const noexcept
friend bool operator<(QLatin1StringView s1, QLatin1StringView s2) noexcept
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
constexpr const storage_type * utf16() const noexcept
qsizetype count(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
int localeAwareCompare(QStringView other) const
ushort toUShort(bool *ok=nullptr, int base=10) const
Returns the string view converted to an {unsigned short} using base base, which is 10 by default and ...
QString arg(Args &&...args) const
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString toString() const
Returns a deep copy of this string view's data as a QString.
int toInt(bool *ok=nullptr, int base=10) const
Returns the string view converted to an int using base base, which is 10 by default and must be betwe...
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
Returns the string view converted to a {long long} using base base, which is 10 by default and must b...
ulong toULong(bool *ok=nullptr, int base=10) const
Returns the string view converted to an {unsigned long} using base base, which is 10 by default and m...
bool isValidUtf16() const noexcept
int compare(QStringView other, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
Returns the string view converted to an {unsigned long long} using base base, which is 10 by default ...
short toShort(bool *ok=nullptr, int base=10) const
Returns the string view converted to a short using base base, which is 10 by default and must be betw...
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
uint toUInt(bool *ok=nullptr, int base=10) const
Returns the string view converted to an {unsigned int} using base base, which is 10 by default and mu...
qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
long toLong(bool *ok=nullptr, int base=10) const
Returns the string view converted to a long using base base, which is 10 by default and must be betwe...
qsizetype toWCharArray(wchar_t *array) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool startsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator<(const QString &s1, const QString &s2) noexcept
QT_ASCII_CAST_WARN friend bool operator<=(const char *s1, const QString &s2)
Returns true if s1 is lexically less than or equal to s2; otherwise returns false.
friend bool operator>(const QString &s1, const QString &s2) noexcept
Returns true if string s1 is lexically greater than string s2; otherwise returns false.
friend bool operator==(const QString &s1, const char16_t *s2) noexcept
friend bool operator!=(std::nullptr_t, const QString &s2) noexcept
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first character in the string.
QString & removeAt(qsizetype pos)
std::u32string toStdU32String() const
QByteArray toLatin1() const &
friend bool operator!=(const QString &s1, const QString &s2) noexcept
Returns true if string s1 is not equal to string s2; otherwise returns false.
friend bool operator<=(const QString &s1, QLatin1StringView s2) noexcept
friend bool operator!=(const QString &s1, QLatin1StringView s2) noexcept
QString & operator+=(QStringView v)
const QChar operator[](qsizetype i) const
friend bool operator==(QChar lhs, const QString &rhs) noexcept
friend bool operator<=(const QString &s1, std::nullptr_t) noexcept
friend bool operator==(QLatin1StringView s1, const QString &s2) noexcept
QT_ASCII_CAST_WARN QString & append(const QByteArray &s)
QString & assign(qsizetype n, QChar c)
QString last(qsizetype n) const
void push_front(QChar c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator!=(const QString &lhs, QChar rhs) noexcept
const_iterator constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just after the last character in...
qsizetype toWCharArray(wchar_t *array) const
static QString fromLatin1(const char *str, qsizetype size)
Returns a QString initialized with the first size characters of the Latin-1 string str.
const_reverse_iterator rbegin() const
std::wstring toStdWString() const
Returns a std::wstring object with the data contained in this QString.
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
static Q_WEAK_OVERLOAD QString fromLocal8Bit(const QByteArray &ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QT_ASCII_CAST_WARN QString(const char *ch)
Constructs a string initialized with the 8-bit string str.
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
iterator erase(const_iterator it)
static QString fromStdU16String(const std::u16string &s)
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & operator+=(QChar c)
const QChar & const_reference
friend bool operator!=(const QString &s1, const char16_t *s2) noexcept
QChar * pointer
The QString::pointer typedef provides an STL-style pointer to a QString element (QChar).
QT_ASCII_CAST_WARN QString(const QByteArray &a)
Constructs a string initialized with the byte array ba.
static QString fromStdString(const std::string &s)
QT_ASCII_CAST_WARN QString & append(const char *s)
QString & operator+=(QUtf8StringView s)
QString & prepend(const QString &s)
Prepends the string str to the beginning of this string and returns a reference to this string.
qsizetype lastIndexOf(QStringView s, qsizetype from, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
friend bool operator==(const QString &s1, const QString &s2) noexcept
iterator Iterator
Qt-style synonym for QString::iterator.
friend bool operator>=(const QString &s1, QLatin1StringView s2) noexcept
QString(DataPointer &&dd)
static int compare(QStringView s1, const QString &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
void push_front(const QString &s)
This function is provided for STL compatibility, prepending the given other string to the beginning o...
static QString fromUcs4(const char32_t *, qsizetype size=-1)
QString & prepend(QStringView v)
void clear()
Clears the contents of the string and makes it null.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
ushort toUShort(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned short} using base base, which is 10 by default and must ...
friend bool operator>=(const QString &s1, const char16_t *s2) noexcept
friend bool operator<=(const QString &lhs, QChar rhs) noexcept
QString(QString &&other) noexcept=default
Move-constructs a QString instance, making it point at the same object that other was pointing to.
friend bool operator<=(std::nullptr_t, const QString &s2) noexcept
bool isValidUtf16() const noexcept
friend bool operator>=(const QString &s1, const QString &s2) noexcept
Returns true if string s1 is lexically greater than or equal to string s2; otherwise returns false.
const_iterator cbegin() const
QString toCaseFolded() const &
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString & setUnicode(const QChar *unicode, qsizetype size)
Resizes the string to size characters and copies unicode into the string.
qsizetype size() const
Returns the number of characters in this string.
QT_ASCII_CAST_WARN friend bool operator==(const char *s1, const QString &s2)
std::string toStdString() const
Returns a std::string object with the data contained in this QString.
const QChar * const_pointer
The QString::const_pointer typedef provides an STL-style const pointer to a QString element (QChar).
QT_ASCII_CAST_WARN friend bool operator!=(const char *s1, const QString &s2)
Returns true if s1 is not equal to s2; otherwise returns false.
uint toUInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned int} using base base, which is 10 by default and must be...
const_iterator cend() const
friend bool operator!=(const QString &s1, std::nullptr_t) noexcept
void push_back(QChar c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QT_ASCII_CAST_WARN QString & operator=(const char *ch)
QString & removeIf(Predicate pred)
friend bool operator==(const char16_t *s1, const QString &s2) noexcept
friend bool operator==(const QString &s1, QLatin1StringView s2) noexcept
QT_ASCII_CAST_WARN QString & operator+=(const char *s)
friend bool operator>=(std::nullptr_t, const QString &s2) noexcept
QStringPrivate DataPointer
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & prepend(QLatin1StringView s)
QT_ASCII_CAST_WARN QString & operator+=(const QByteArray &s)
QString ::type arg(Args &&...args) const
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
QString & insert(qsizetype i, const QString &s)
QString & assign(InputIterator first, InputIterator last)
SectionFlag
This enum specifies flags that can be used to affect various aspects of the section() function's beha...
friend bool operator>=(QLatin1StringView s1, const QString &s2) noexcept
QString section(QChar sep, qsizetype start, qsizetype end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
QString first(qsizetype n) const
friend bool operator!=(QChar lhs, const QString &rhs) noexcept
friend bool operator!=(const char16_t *s1, const QString &s2) noexcept
constexpr QString() noexcept
Constructs a null string.
bool isSharedWith(const QString &other) const
QT_ASCII_CAST_WARN QString & operator=(const QByteArray &a)
qsizetype capacity() const
Returns the maximum number of characters that can be stored in the string without forcing a reallocat...
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned long long} using base base, which is 10 by default and m...
QString simplified() const &
friend bool operator==(std::nullptr_t, const QString &s2) noexcept
const_reverse_iterator crbegin() const
iterator end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing just after the last character in the ...
static QString fromLocal8Bit(const char *str, qsizetype size)
Returns a QString initialized with the first size characters of the 8-bit string str.
static int compare(const QString &s1, QLatin1StringView s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
static int compare(const QString &s1, QStringView s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
QT_ASCII_CAST_WARN QString & insert(qsizetype i, const QByteArray &s)
long toLong(bool *ok=nullptr, int base=10) const
Returns the string converted to a long using base base, which is 10 by default and must be between 2 ...
QT_ASCII_CAST_WARN QString & insert(qsizetype i, const char *s)
qlonglong toLongLong(bool *ok=nullptr, int base=10) const
Returns the string converted to a {long long} using base base, which is 10 by default and must be bet...
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
friend bool operator>=(const char16_t *s1, const QString &s2) noexcept
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
friend bool operator>=(QChar lhs, const QString &rhs) noexcept
short toShort(bool *ok=nullptr, int base=10) const
Returns the string converted to a short using base base, which is 10 by default and must be between 2...
static int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & prepend(const QChar *uc, qsizetype len)
QString & operator+=(const QString &s)
Appends the string other onto the end of this string and returns a reference to this string.
QString sliced(qsizetype pos, qsizetype n) const
const_reverse_iterator crend() const
QT_ASCII_CAST_WARN friend bool operator>=(const char *s1, const QString &s2)
Returns true if s1 is lexically greater than or equal to s2; otherwise returns false.
QString toLower() const &
qsizetype lastIndexOf(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & append(QStringView v)
QString & insert(qsizetype i, QStringView v)
static QString fromStdU32String(const std::u32string &s)
QByteArray toLocal8Bit() const &
auto tokenize(Needle &&needle, Flags...flags) const &&noexcept(noexcept(qTokenize(std::declval< const QString >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(std::move(*this), std::forward< Needle >(needle), flags...))
const DataPointer & data_ptr() const
void push_back(const QString &s)
This function is provided for STL compatibility, appending the given other string onto the end of thi...
QChar * data()
Returns a pointer to the data stored in the QString.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
QString sliced(qsizetype pos) const
friend bool operator<=(QChar lhs, const QString &rhs) noexcept
QString & operator+=(QLatin1StringView s)
void squeeze()
Releases any memory not required to store the character data.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & setUtf16(const ushort *utf16, qsizetype size)
Resizes the string to size characters and copies unicode into the string.
int localeAwareCompare(const QString &s) const
QT_ASCII_CAST_WARN QString & prepend(const QByteArray &s)
auto tokenize(Needle &&needle, Flags...flags) &&noexcept(noexcept(qTokenize(std::declval< QString >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(std::move(*this), std::forward< Needle >(needle), flags...))
std::u16string toStdU16String() const
QString trimmed() const &
QString & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString chopped(qsizetype n) const
std::reverse_iterator< const_iterator > const_reverse_iterator
QT_ASCII_CAST_WARN QString & prepend(const char *s)
ulong toULong(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned long} using base base, which is 10 by default and must b...
static QString fromUtf8(const char *utf8, qsizetype size)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QByteArray toUtf8() const &
static Q_WEAK_OVERLOAD QString fromLatin1(const QByteArray &ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool operator<=(const char16_t *s1, const QString &s2) noexcept
static int localeAwareCompare(const QString &s1, const QString &s2)
Compares s1 with s2 and returns an integer less than, equal to, or greater than zero if s1 is less th...
QString & prepend(QUtf8StringView s)
QStringList split(const QRegularExpression &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts) const
static QString fromStdWString(const std::wstring &s)
Returns a copy of the str string.
friend bool operator>=(const QString &, std::nullptr_t) noexcept
friend bool operator==(const QString &s1, std::nullptr_t) noexcept
QString & prepend(QChar c)
QByteArray toLocal8Bit() &&
auto tokenize(Needle &&needle, Flags...flags) const &noexcept(noexcept(qTokenize(std::declval< const QString & >(), std::forward< Needle >(needle), flags...))) -> decltype(qTokenize(*this, std::forward< Needle >(needle), flags...))
QString toUpper() const &
std::reverse_iterator< iterator > reverse_iterator
friend bool operator!=(QLatin1StringView s1, const QString &s2) noexcept
const_reverse_iterator rend() const
const_iterator constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character in the st...
QString toCaseFolded() &&
friend bool operator>=(const QString &lhs, QChar rhs) noexcept
NormalizationForm
This enum describes the various normalized forms of Unicode text.
friend bool operator==(const QString &lhs, QChar rhs) noexcept
const_iterator ConstIterator
Qt-style synonym for QString::const_iterator.
qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
static int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype length() const
Returns the number of characters in this string.
reverse_iterator rbegin()
friend bool operator<=(const QString &s1, const QString &s2) noexcept
Returns true if string s1 is lexically less than or equal to string s2; otherwise returns false.
friend bool operator<=(QLatin1StringView s1, const QString &s2) noexcept
const QChar * unicode() const
Returns a Unicode representation of the string.
int compare(QChar ch, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
const QChar * const_iterator
~QString()
Destroys the string.
friend bool operator<=(const QString &s1, const char16_t *s2) noexcept
bool endsWith(QStringView s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
void resize(qsizetype size)
Sets the size of the string to size characters.
static Q_WEAK_OVERLOAD QString fromUtf8(const QByteArray &ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
list append(new Employee("Blackpool", "Stephen"))
cache insert(employee->id(), employee)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
qsizetype fromUtf8(uchar b, OutputPtr &dst, InputPtr &src, InputPtr end)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT QString convertToQString(QAnyStringView s)
const QString & asString(const QString &s)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype lastIndexOf(QByteArrayView haystack, qsizetype from, QByteArrayView needle) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype count(QByteArrayView haystack, QByteArrayView needle) noexcept
QStringViewArg qStringLikeToArg(const QString &s) noexcept
std::is_same< Char, char32_t > IsCompatibleChar32TypeHelper
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT QString argToQString(QStringView pattern, size_t n, const ArgBase **args)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_ALWAYS_INLINE QString argToQStringDispatch(StringView pattern, const Args &...args)
IsCompatibleChar32TypeHelper< q20::remove_cvref_t< Char > > IsCompatibleChar32Type
constexpr bool isLatin1(QLatin1StringView s) noexcept
constexpr T * to_address(T *p) noexcept
qsizetype erase_if(QByteArray &ba, Predicate pred)
qsizetype erase(QByteArray &ba, const T &t)
size_t qstrlen(const char *str)
#define Q_DECL_NS_RETURNS_AUTORELEASED
#define QT_WARNING_DISABLE_INTEL(number)
#define Q_DECL_CF_RETURNS_RETAINED
#define QT_IGNORE_DEPRECATIONS(statement)
#define QT_WARNING_DISABLE_MSVC(number)
#define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
constexpr timespec & operator+=(timespec &t1, const timespec &t2)
#define Q_FORWARD_DECLARE_CF_TYPE(type)
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
static T toIntegral_helper(const QLocalePrivate *d, QStringView str, bool *ok)
constexpr const T & qMax(const T &a, const T &b)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLint GLenum GLboolean normalized
GLenum GLint GLint * precision
bool operator>(const QPoint &a, const QPoint &b)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
static void split(QT_FT_Vector *b)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
static constexpr QChar sep
qsizetype erase_if(QString &s, Predicate pred)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QString &)
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QString &)
QString operator+(const QString &s1, const QString &s2)
qsizetype erase(QString &s, const T &t)
static QChar * fromLocal8Bit(QChar *out, QByteArrayView in, QStringConverter::State *state)
static char * toLocal8Bit(char *out, QStringView in, QStringConverter::State *state)
QBasicUtf8StringView< false > QUtf8StringView
QArrayDataPointer< char16_t > QStringPrivate
constexpr auto qTokenize(Haystack &&h, Needle &&n, Flags...flags) noexcept(QtPrivate::Tok::is_nothrow_constructible_from< Haystack, Needle >::value) -> decltype(QtPrivate::Tok::TokenizerResult< Haystack, Needle >{std::forward< Haystack >(h), std::forward< Needle >(n), flags...})
QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
#define QT_ASCII_CAST_WARN
#define QT_DEPRECATED_VERSION_X_6_4(text)
#define QT_DEPRECATED_VERSION_X_6_0(text)
#define QT_DEPRECATED_VERSION_X_6_8(text)
static int compare(quint64 a, quint64 b)
unsigned long long quint64
bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
bool operator>=(const QUuid &lhs, const QUuid &rhs) noexcept
static double toDouble(Value v)
settings remove("monkey")
QTextStream out(stdout)
[7]
@ CapacityReserved
the capacity was reserved by the user, try to keep it
\inmodule QtCore \reentrant
enum QtPrivate::ArgBase::Tag tag
constexpr QLatin1StringArg(QLatin1StringView v) noexcept
QLatin1StringArg()=default
constexpr QStringViewArg(QStringView v) noexcept