Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::String Class Reference

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 stripToHexOnly (QString string)
 
static QString trimLeading (const QStringView string)
 
static QString trimTrailing (const QStringView string)
 

Member Function Documentation

◆ isHexNumber()

bool Qx::String::isHexNumber ( QString hexNum)
static

Returns true if hexNum consists only of numbers and letters A through F (case-insensitive); otherwise returns false.

◆ isOnlyNumbers()

bool Qx::String::isOnlyNumbers ( QString checkStr)
static

Returns true if checkStr consists only of numbers; otherwise returns false.

◆ isValidChecksum()

bool Qx::String::isValidChecksum ( QString checksum,
QCryptographicHash::Algorithm hashAlgorithm )
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.

◆ join() [1/4]

QString Qx::String::join ( QList< QString > list,
QString separator = {},
QString prefix = {} )
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.

See also
QStringList::join().

◆ join() [2/4]

template<typename T , typename F >
requires defines_call_for_s<F, QString, const T&>
QString Qx::String::join ( QList< T > list,
F && toStringFunc,
QString separator = {},
QString prefix = {} )
inlinestatic

Joins all arbitrarily typed elements from a list into a single string with optional formatting.

Parameters
[in]listThe list of elements to join
[in]toStringFuncA function that takes a single element of type T and returns a QString
[in]separatorAn optional character to place between each element
[in]prefixAn optional string to place before each element

◆ join() [3/4]

QString Qx::String::join ( QSet< QString > set,
QString separator = {},
QString prefix = {} )
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.

◆ join() [4/4]

template<typename T , typename F >
requires defines_call_for_s<F, QString, const T&>
QString Qx::String::join ( QSet< T > set,
F && toStringFunc,
QString separator = {},
QString prefix = {} )
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.

Parameters
[in]setThe set of elements to join
[in]toStringFuncA function that takes a single element of type T and returns a QString
[in]separatorAn optional character to place between each element
[in]prefixAn optional string to place before each element

◆ stripToHexOnly()

QString Qx::String::stripToHexOnly ( QString string)
static

Returns a copy of string with all non-hexadecimal characters removed.

◆ trimLeading()

QString Qx::String::trimLeading ( const QStringView string)
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.

See also
trimTrailing() and QString::trimmed().

◆ trimTrailing()

QString Qx::String::trimTrailing ( const QStringView string)
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.

See also
trimLeading() and QString::trimmed().

The documentation for this class was generated from the following files: