4#ifndef QSTRINGALGORITHMS_H
5#define QSTRINGALGORITHMS_H
7#include <QtCore/qnamespace.h>
8#include <QtCore/qstringfwd.h>
9#include <QtCore/qcontainerfwd.h>
11#pragma qt_class(QStringAlgorithms)
75#if QT_CONFIG(regularexpression)
121template <
typename Char,
size_t N> [[nodiscard]]
constexpr Q_ALWAYS_INLINE
128 constexpr size_t RuntimeThreshold =
129#if defined(Q_CC_CLANG)
131#elif defined(Q_CC_GNU)
132 __cplusplus >= 202002L ? 39 : 17
137 if constexpr (N == 1) {
138 return str[0] ==
Char(0) ? 0 : 1;
139 }
else if constexpr (N > RuntimeThreshold) {
140#ifdef QT_SUPPORTS_IS_CONSTANT_EVALUATED
141 if (!qIsConstantEvaluated())
149#if __cplusplus >= 202002 && defined(__cpp_lib_constexpr_algorithms)
153 const auto it = std::char_traits<Char>::find(
str, N,
Char(0));
154 return it ? std::distance(
str,
it) : ptrdiff_t(N);
158template <
typename Char,
size_t N> [[nodiscard]]
constexpr inline
162 const auto it = std::char_traits<Char>::find(
str, N,
Char(0));
163 return it ? std::distance(
str,
it) : ptrdiff_t(N);
166template <
typename Container>
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QByteArrayView haystack, QByteArrayView needle) noexcept
constexpr Q_ALWAYS_INLINE std::enable_if_t< sizeof(Char)==sizeof(char16_t), qsizetype > lengthHelperContainer(const Char(&str)[N])
Q_CORE_EXPORT QString convertToQString(QAnyStringView s)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const char16_t *str) noexcept
Q_CORE_EXPORT QList< uint > convertToUcs4(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QByteArrayView trimmed(QByteArrayView s) noexcept
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 QByteArray convertToLocal8Bit(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool equalStrings(QStringView lhs, QStringView rhs) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept
Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str)
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrnlen(const char16_t *str, qsizetype maxlen) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
qsizetype indexOf(const QList< V > &list, const U &u, qsizetype from) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const char16_t * qustrchr(QStringView str, char16_t ch) noexcept
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1StringView s) noexcept
Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str)
constexpr bool isLatin1(QLatin1StringView s) noexcept
#define Q_DECL_PURE_FUNCTION
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLenum GLsizei count