Qx v0.6
Qt Extensions Library
|
The String class is a collection of static functions pertaining to string types.
#include <qx/core/qx-string.h>
Static Public Member Functions | |
static bool | isHexNumber (QString hexNum) |
static bool | isOnlyNumbers (QString checkStr) |
static bool | isValidChecksum (QString checksum, QCryptographicHash::Algorithm hashAlgorithm) |
static QString | join (QList< QString > list, QString separator={}, QString prefix={}) |
template<typename T , typename F > requires defines_call_for_s<F, QString, const T&> | |
static QString | join (QList< T > list, F &&toStringFunc, QString separator={}, QString prefix={}) |
static QString | join (QSet< QString > set, QString separator={}, QString prefix={}) |
template<typename T , typename F > requires defines_call_for_s<F, QString, const T&> | |
static QString | join (QSet< T > set, F &&toStringFunc, QString separator={}, QString prefix={}) |
static QString | mapArg (QAnyStringView s, const QMap< QString, QString > &map, Qt::CaseSensitivity cs=Qt::CaseSensitive) |
static QString | stripToHexOnly (QString string) |
static QString | trimLeading (const QStringView string) |
static QString | trimTrailing (const QStringView string) |
|
static |
Returns true
if hexNum consists only of numbers and letters A through F (case-insensitive); otherwise returns false
.
|
static |
Returns true
if checkStr consists only of numbers; otherwise returns false
.
|
static |
Returns true
if checksum consists only of valid hexadecimal characters and is the exact length required for a hexadecimal string representation of hashAlgorithm; otherwise returns false
.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Joins all the strings in list with an optional separator and prefix for each element into a single string.
|
inlinestatic |
Joins all arbitrarily typed elements from a list into a single string with optional formatting.
[in] | list | The list of elements to join |
[in] | toStringFunc | A function that takes a single element of type T and returns a QString |
[in] | separator | An optional character to place between each element |
[in] | prefix | An optional string to place before each element |
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Joins all the strings in set with an optional separator and prefix for each element into a single string.
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Joins all arbitrarily typed elements from a set into a single string with optional formatting.
[in] | set | The set of elements to join |
[in] | toStringFunc | A function that takes a single element of type T and returns a QString |
[in] | separator | An optional character to place between each element |
[in] | prefix | An optional string to place before each element |
|
static |
Returns a copy of s with all occurances of each key in args replaced with their corresponding value, using the case sensitivity setting cs.
Similar to the templated version of QString::arg(), this function checks for all replacements in one pass and only performs one heap allocation for the final string, so it should perform much better than chaining QString::replace() multiple times, especially when there is a significant number of replacements.
Returns a copy of string with all non-hexadecimal characters removed.
|
static |
Returns a copy of string with all whitespace at the beginning of the string removed.
Whitespace means any character for which QChar::isSpace() returns true
. This includes the ASCII characters \t
, \n
, \v
, \f
, \r
, and .
Internal whitespace is unaffected.
|
static |
Returns a copy of string with all whitespace at the end of the string removed.
Whitespace means any character for which QChar::isSpace() returns true
. This includes the ASCII characters \t
, \n
, \v
, \f
, \r
, and .
Internal whitespace is unaffected.