Rudiments
Static Public Member Functions | List of all members
wcharstring Class Reference

Static Public Member Functions

static size_t length (const wchar_t *string)
 
static size_t size (const wchar_t *string)
 
static bool isNullOrEmpty (const wchar_t *string)
 
static bool isYes (const wchar_t *string)
 
static bool isNo (const wchar_t *string)
 
static void zero (wchar_t *str, size_t len)
 
static wchar_t * append (wchar_t *dest, const wchar_t *source)
 
static wchar_t * append (wchar_t *dest, const wchar_t *source, size_t size)
 
static wchar_t * append (wchar_t *dest, int64_t number)
 
static wchar_t * append (wchar_t *dest, uint64_t number)
 
static wchar_t * append (wchar_t *dest, double number)
 
static wchar_t * append (wchar_t *dest, double number, uint16_t scale)
 
static wchar_t * append (wchar_t *dest, double number, uint16_t precision, uint16_t scale)
 
static wchar_t * copy (wchar_t *dest, const wchar_t *source)
 
static wchar_t * copy (wchar_t *dest, const wchar_t *source, size_t size)
 
static wchar_t * copy (wchar_t *dest, size_t location, const wchar_t *source)
 
static wchar_t * copy (wchar_t *dest, size_t location, const wchar_t *source, size_t size)
 
static wchar_t * safeCopy (wchar_t *dest, size_t destlen, const wchar_t *source)
 
static wchar_t * safeCopy (wchar_t *dest, size_t destlen, const wchar_t *source, size_t sourcesize)
 
static int32_t compare (const wchar_t *str1, const wchar_t *str2)
 
static int32_t compare (const wchar_t *str1, const wchar_t *str2, size_t size)
 
static int32_t compareIgnoringCase (const wchar_t *str1, const wchar_t *str2)
 
static int32_t compareIgnoringCase (const wchar_t *str1, const wchar_t *str2, size_t size)
 
static bool inSet (const wchar_t *str, const wchar_t *const *set)
 
static bool inSetIgnoringCase (const wchar_t *str, const wchar_t *const *set)
 
static bool contains (const wchar_t *haystack, const wchar_t *needle)
 
static bool containsIgnoringCase (const wchar_t *haystack, const wchar_t *needle)
 
static bool contains (const wchar_t *haystack, wchar_t needle)
 
static bool containsIgnoringCase (const wchar_t *haystack, wchar_t needle)
 
static bool startsWith (const wchar_t *haystack, const wchar_t *needle)
 
static bool endsWith (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findFirst (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findFirstIgnoringCase (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findFirst (const wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findFirstIgnoringCase (const wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findFirstOrEnd (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findFirstOrEndIgnoringCase (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findFirstOrEnd (const wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findFirstOrEndIgnoringCase (const wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findLast (const wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findLast (const wchar_t *haystack, wchar_t needle)
 
static wchar_t * findFirst (wchar_t *haystack, const wchar_t *needle)
 
static wchar_t * findFirstIgnoringCase (wchar_t *haystack, const wchar_t *needle)
 
static wchar_t * findFirst (wchar_t *haystack, wchar_t needle)
 
static wchar_t * findFirstIgnoringCase (wchar_t *haystack, wchar_t needle)
 
static wchar_t * findFirstOrEnd (wchar_t *haystack, const wchar_t *needle)
 
static wchar_t * findFirstOrEndIgnoringCase (wchar_t *haystack, const wchar_t *needle)
 
static wchar_t * findLast (wchar_t *haystack, const wchar_t *needle)
 
static const wchar_t * findLastIgnoringCase (const wchar_t *haystack, const wchar_t *needle)
 
static wchar_t * findLast (wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findLastIgnoringCase (const wchar_t *haystack, wchar_t needle)
 
static const wchar_t * findFirstOfSet (const wchar_t *haystack, const wchar_t *set)
 
static wchar_t * findFirstOfSet (wchar_t *haystack, const wchar_t *set)
 
static const wchar_t * findFirstOfSetOrEnd (const wchar_t *haystack, const wchar_t *set)
 
static wchar_t * findFirstOfSetOrEnd (wchar_t *haystack, const wchar_t *set)
 
static const wchar_t * findLastOfSet (const wchar_t *haystack, const wchar_t *set)
 
static wchar_t * findLastOfSet (wchar_t *haystack, const wchar_t *set)
 
static const wchar_t * findLastOfSetOrEnd (const wchar_t *haystack, const wchar_t *set)
 
static wchar_t * findLastOfSetOrEnd (wchar_t *haystack, const wchar_t *set)
 
static wchar_t * before (const wchar_t *str, const wchar_t *delimiter)
 
static wchar_t * between (const wchar_t *str, const wchar_t *start, const wchar_t *end)
 
static wchar_t * after (const wchar_t *str, const wchar_t *delimiter)
 
static size_t lengthContainingSet (const wchar_t *haystack, const wchar_t *set)
 
static size_t lengthNotContainingSet (const wchar_t *haystack, const wchar_t *set)
 
static wchar_t * duplicate (const wchar_t *str)
 
static wchar_t * duplicate (const char *str, size_t len)
 
static wchar_t * duplicate (const char *str)
 
static wchar_t * duplicate (const wchar_t *str, size_t len)
 
static void upper (wchar_t *str)
 
static void lower (wchar_t *str)
 
static void capitalize (wchar_t *str)
 
static void rightTrim (wchar_t *str)
 
static void rightTrim (wchar_t *str, wchar_t character)
 
static void leftTrim (wchar_t *str)
 
static void leftTrim (wchar_t *str, wchar_t character)
 
static void bothTrim (wchar_t *str)
 
static void bothTrim (wchar_t *str, wchar_t character)
 
static bool strip (wchar_t *str, wchar_t character)
 
static bool strip (wchar_t *str1, const wchar_t *str2)
 
static bool stripSet (wchar_t *str1, const wchar_t *set)
 
static void replace (wchar_t *str, wchar_t oldchar, wchar_t newchar)
 
static void replace (wchar_t *str, const wchar_t *oldchars, wchar_t newchar)
 
static wchar_t * replace (const wchar_t *str, const wchar_t *oldstr, const wchar_t *newstr)
 
static wchar_t * replace (const wchar_t *str, const wchar_t *const *oldstrset, ssize_t *oldstrlen, const wchar_t *const *newstrset)
 
static uint16_t integerLength (int16_t number)
 
static uint16_t integerLength (int32_t number)
 
static uint16_t integerLength (int64_t number)
 
static uint16_t integerLength (uint16_t number)
 
static uint16_t integerLength (uint32_t number)
 
static uint16_t integerLength (uint64_t number)
 
static bool isInteger (const wchar_t *val)
 
static bool isInteger (const wchar_t *val, int32_t size)
 
static bool isNumber (const wchar_t *val)
 
static bool isNumber (const wchar_t *val, int32_t size)
 
static wchar_t * parseNumber (int16_t number)
 
static wchar_t * parseNumber (uint16_t number)
 
static wchar_t * parseNumber (int16_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (uint16_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (int32_t number)
 
static wchar_t * parseNumber (uint32_t number)
 
static wchar_t * parseNumber (int32_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (uint32_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (int64_t number)
 
static wchar_t * parseNumber (uint64_t number)
 
static wchar_t * parseNumber (int64_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (uint64_t number, uint16_t zeropadding)
 
static wchar_t * parseNumber (float number)
 
static wchar_t * parseNumber (float number, uint16_t scale)
 
static wchar_t * parseNumber (float number, uint16_t precision, uint16_t scale)
 
static wchar_t * parseNumber (double number)
 
static wchar_t * parseNumber (double number, uint16_t scale)
 
static wchar_t * parseNumber (double number, uint16_t precision, uint16_t scale)
 
static wchar_t * parseNumber (long double number)
 
static wchar_t * parseNumber (long double number, uint16_t scale)
 
static wchar_t * parseNumber (long double number, uint16_t precision, uint16_t scale)
 
static int64_t toInteger (const wchar_t *string)
 
static int64_t toInteger (const wchar_t *string, const wchar_t **endptr)
 
static int64_t toInteger (const wchar_t *string, int32_t base)
 
static int64_t toInteger (const wchar_t *string, const wchar_t **endptr, int32_t base)
 
static uint64_t toUnsignedInteger (const wchar_t *string)
 
static uint64_t toUnsignedInteger (const wchar_t *string, const wchar_t **endptr)
 
static uint64_t toUnsignedInteger (const wchar_t *string, int32_t base)
 
static uint64_t toUnsignedInteger (const wchar_t *string, const wchar_t **endptr, int32_t base)
 
static long double toFloat (const wchar_t *string)
 
static long double toFloatC (const wchar_t *string)
 
static long double toFloat (const wchar_t *string, const wchar_t **endptr)
 
static int64_t convertAmount (const wchar_t *amount)
 
static wchar_t * convertAmount (int64_t amount)
 
static wchar_t * convertAmount (int64_t amount, uint16_t padding)
 
static wchar_t * escape (const wchar_t *input, const wchar_t *characters)
 
static wchar_t * unescape (const wchar_t *input)
 
static void escape (const wchar_t *input, uint64_t inputsize, wchar_t **output, uint64_t *outputsize, const wchar_t *characters)
 
static void unescape (const wchar_t *input, uint64_t inputsize, wchar_t **output, uint64_t *outputsize)
 
static void leftJustify (wchar_t *str, int32_t len)
 
static void rightJustify (wchar_t *str, int32_t len)
 
static void center (wchar_t *str, int32_t len)
 
static wchar_t * pad (const wchar_t *string, wchar_t padchar, int16_t direction, uint64_t totallength)
 
static void split (const wchar_t *string, ssize_t stringlength, const wchar_t *delimiter, ssize_t delimiterlength, bool collapse, wchar_t ***list, uint64_t *listlength)
 
static void split (const wchar_t *string, const wchar_t *delimiter, ssize_t delimiterlength, bool collapse, wchar_t ***list, uint64_t *listlength)
 
static void split (const wchar_t *string, ssize_t stringlength, const wchar_t *delimiter, bool collapse, wchar_t ***list, uint64_t *listlength)
 
static void split (const wchar_t *string, const wchar_t *delimiter, bool collapse, wchar_t ***list, uint64_t *listlength)
 
static wchar_t * subString (const wchar_t *str, size_t start, size_t end)
 
static wchar_t * subString (const wchar_t *str, size_t start)
 
static wchar_t * insertString (const wchar_t *dest, const wchar_t *src, uint64_t index)
 
static ssize_t printf (wchar_t *buffer, size_t len, const wchar_t *format,...)
 
static ssize_t printf (wchar_t *buffer, size_t len, const wchar_t *format, va_list *argp)
 
static ssize_t printf (wchar_t **buffer, const wchar_t *format,...)
 
static ssize_t printf (wchar_t **buffer, const wchar_t *format, va_list *argp)
 

Detailed Description

The wcharstring class provides static methods for manipulating C-style wide character strings.

In addition to some unique methods, analogs for the standard C wide string functions are provided. However, unlike the standard C wide string functions, the wcharstring methods are NULL safe. Your application will not crash if a NULL is passed in, and instead, will give intuitive results.

Member Function Documentation

◆ after()

static wchar_t* wcharstring::after ( const wchar_t *  str,
const wchar_t *  delimiter 
)
static

Returns the string from the "delimiter" until the end of the string. Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.

◆ append() [1/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
const wchar_t *  source 
)
static

Appends "source" to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [2/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
const wchar_t *  source,
size_t  size 
)
static

Appends "size" bytes of "source" to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [3/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
double  number 
)
static

Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [4/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
double  number,
uint16_t  precision,
uint16_t  scale 
)
static

Converts "number" to a string using "precision" and "scale" and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [5/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
double  number,
uint16_t  scale 
)
static

Converts "number" to a string using "scale" and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [6/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
int64_t  number 
)
static

Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ append() [7/7]

static wchar_t* wcharstring::append ( wchar_t *  dest,
uint64_t  number 
)
static

Converts "number" to a string and appends it to "dest". Assumes that there is enough room remaining in "dest" to accommodate the new string. Returns a pointer to "dest".

◆ before()

static wchar_t* wcharstring::before ( const wchar_t *  str,
const wchar_t *  delimiter 
)
static

Returns the string from the beginning of "str" until Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.

◆ between()

static wchar_t* wcharstring::between ( const wchar_t *  str,
const wchar_t *  start,
const wchar_t *  end 
)
static

Returns the string between "start" and "end". Note that this method allocates a buffer for the return value internally and returns it. The calling program must deallocate this buffer.

◆ bothTrim() [1/2]

static void wcharstring::bothTrim ( wchar_t *  str)
static

Trims all spaces off of both sides of "str".

◆ bothTrim() [2/2]

static void wcharstring::bothTrim ( wchar_t *  str,
wchar_t  character 
)
static

Trims all characters off of both sides of "str".

◆ capitalize()

static void wcharstring::capitalize ( wchar_t *  str)
static

Captitalizes "str", converting characters to upper or lower case as necessary.

◆ center()

static void wcharstring::center ( wchar_t *  str,
int32_t  len 
)
static

Centers the text of "str" for "len" characters.

Example: "hello " -> " hello "

◆ compare() [1/2]

static int32_t wcharstring::compare ( const wchar_t *  str1,
const wchar_t *  str2 
)
static

Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2".

◆ compare() [2/2]

static int32_t wcharstring::compare ( const wchar_t *  str1,
const wchar_t *  str2,
size_t  size 
)
static

Returns -1,0 or 1 if "size" bytes of "str1" are greater than, equal to or less than "size" bytes of "str2".

◆ compareIgnoringCase() [1/2]

static int32_t wcharstring::compareIgnoringCase ( const wchar_t *  str1,
const wchar_t *  str2 
)
static

Returns -1,0 or 1 if "str1" is greater than, equal to or less than "str2", ignoring case.

◆ compareIgnoringCase() [2/2]

static int32_t wcharstring::compareIgnoringCase ( const wchar_t *  str1,
const wchar_t *  str2,
size_t  size 
)
static

Returns -1,0 or 1 if "size" bytes of "str1" are greater than, equal to or less than "size" bytes of "str2", ignoring case.

◆ contains() [1/2]

static bool wcharstring::contains ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns true if "haystack" contains "needle" or false otherwise.

◆ contains() [2/2]

static bool wcharstring::contains ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns true if "haystack" contains "needle" or false otherwise.

◆ containsIgnoringCase() [1/2]

static bool wcharstring::containsIgnoringCase ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns true if "haystack" contains "needle", ignoring case, or false otherwise.

◆ containsIgnoringCase() [2/2]

static bool wcharstring::containsIgnoringCase ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns true if "haystack" contains "needle", ignoring case, or false otherwise.

◆ convertAmount() [1/3]

static int64_t wcharstring::convertAmount ( const wchar_t *  amount)
static

Converts "amount" which is assumed to be a dollar amount into pennies.

◆ convertAmount() [2/3]

static wchar_t* wcharstring::convertAmount ( int64_t  amount)
static

Converts "amount" which is assumed to be a number of pennies into a dollar amount string.

◆ convertAmount() [3/3]

static wchar_t* wcharstring::convertAmount ( int64_t  amount,
uint16_t  padding 
)
static

Converts "amount" which is assumed to be a number of pennies into a dollar amount string where there are "padding" places between the dollar sign and decimal point. These will be space padded if the amount is small enough not to fill them.

◆ copy() [1/4]

static wchar_t* wcharstring::copy ( wchar_t *  dest,
const wchar_t *  source 
)
static

Replaces "dest" with "source". Assumes that there is enough room in "dest" to accommodate "source". Returns a pointer to "dest".

◆ copy() [2/4]

static wchar_t* wcharstring::copy ( wchar_t *  dest,
const wchar_t *  source,
size_t  size 
)
static

Replaces the first "size" bytes of "dest" with "source". Assumes that "dest" is at least "size" bytes long. Returns a pointer to "dest".

◆ copy() [3/4]

static wchar_t* wcharstring::copy ( wchar_t *  dest,
size_t  location,
const wchar_t *  source 
)
static

Replaces "dest" with "source", starting "location" bytes into "dest". Assumes that there is enough room in "dest" (after "location" bytes) to accommodate "source". Returns a pointer to "dest".

◆ copy() [4/4]

static wchar_t* wcharstring::copy ( wchar_t *  dest,
size_t  location,
const wchar_t *  source,
size_t  size 
)
static

Replaces "size" bytes of "dest" with "source", starting "location" bytes into "dest". Assumes that there are "size" bytes in "dest" (after "location" bytes). Returns a pointer to "dest".

◆ duplicate() [1/4]

static wchar_t* wcharstring::duplicate ( const char *  str)
static

Creates a duplicate of "str", converts it to a wide string, and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.

◆ duplicate() [2/4]

static wchar_t* wcharstring::duplicate ( const char *  str,
size_t  len 
)
static

Creates a duplicate of the first "len" characters of "str", converts it to a wide string, and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.

◆ duplicate() [3/4]

static wchar_t* wcharstring::duplicate ( const wchar_t *  str)
static

Creates a duplicate of "str" and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.

◆ duplicate() [4/4]

static wchar_t* wcharstring::duplicate ( const wchar_t *  str,
size_t  len 
)
static

Creates a duplicate of the first "len" characters of "str" and returns a pointer to it. Note that this method allocates a buffer for the duplicate string internally and returns it. The calling program must deallocate this buffer.

◆ endsWith()

static bool wcharstring::endsWith ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns true if "haystack" ends with "needle" or false otherwise.

◆ escape() [1/2]

static wchar_t* wcharstring::escape ( const wchar_t *  input,
const wchar_t *  characters 
)
static

escapes all characters in "characters" found in "input" using \'s and returns it in a buffer allocated inside the function. This buffer must be deleted by the calling program.

◆ escape() [2/2]

static void wcharstring::escape ( const wchar_t *  input,
uint64_t  inputsize,
wchar_t **  output,
uint64_t *  outputsize,
const wchar_t *  characters 
)
static

similar to escape() above, but takes an "inputsize" parameter and returns the result in "output" and "outputsize" rather than in a return value

◆ findFirst() [1/4]

static const wchar_t* wcharstring::findFirst ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.

◆ findFirst() [2/4]

static const wchar_t* wcharstring::findFirst ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.

◆ findFirst() [3/4]

static wchar_t* wcharstring::findFirst ( wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.

◆ findFirst() [4/4]

static wchar_t* wcharstring::findFirst ( wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or NULL if not found.

◆ findFirstIgnoringCase() [1/4]

static const wchar_t* wcharstring::findFirstIgnoringCase ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findFirstIgnoringCase() [2/4]

static const wchar_t* wcharstring::findFirstIgnoringCase ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findFirstIgnoringCase() [3/4]

static wchar_t* wcharstring::findFirstIgnoringCase ( wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findFirstIgnoringCase() [4/4]

static wchar_t* wcharstring::findFirstIgnoringCase ( wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findFirstOfSet() [1/2]

static const wchar_t* wcharstring::findFirstOfSet ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or NULL if not found.

◆ findFirstOfSet() [2/2]

static wchar_t* wcharstring::findFirstOfSet ( wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or NULL if not found.

◆ findFirstOfSetOrEnd() [1/2]

static const wchar_t* wcharstring::findFirstOfSetOrEnd ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the first occurence in "haystack" of any of the characters in "set" or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOfSetOrEnd() [2/2]

static wchar_t* wcharstring::findFirstOfSetOrEnd ( wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the first occurence in "haystack" of any of the characters in "set". or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEnd() [1/3]

static const wchar_t* wcharstring::findFirstOrEnd ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEnd() [2/3]

static const wchar_t* wcharstring::findFirstOrEnd ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEnd() [3/3]

static wchar_t* wcharstring::findFirstOrEnd ( wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack" or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEndIgnoringCase() [1/3]

static const wchar_t* wcharstring::findFirstOrEndIgnoringCase ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEndIgnoringCase() [2/3]

static const wchar_t* wcharstring::findFirstOrEndIgnoringCase ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.

◆ findFirstOrEndIgnoringCase() [3/3]

static wchar_t* wcharstring::findFirstOrEndIgnoringCase ( wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the first occurrance of "needle" in "haystack", ignoring case, or a pointer to the NULL terminator at the end of the string if not found.

◆ findLast() [1/4]

static const wchar_t* wcharstring::findLast ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.

◆ findLast() [2/4]

static const wchar_t* wcharstring::findLast ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.

◆ findLast() [3/4]

static wchar_t* wcharstring::findLast ( wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.

◆ findLast() [4/4]

static wchar_t* wcharstring::findLast ( wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack" or NULL if not found.

◆ findLastIgnoringCase() [1/2]

static const wchar_t* wcharstring::findLastIgnoringCase ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findLastIgnoringCase() [2/2]

static const wchar_t* wcharstring::findLastIgnoringCase ( const wchar_t *  haystack,
wchar_t  needle 
)
static

Returns a pointer to the last occurrance of "needle" in "haystack", ignoring case, or NULL if not found.

◆ findLastOfSet() [1/2]

static const wchar_t* wcharstring::findLastOfSet ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or NULL if not found.

◆ findLastOfSet() [2/2]

static wchar_t* wcharstring::findLastOfSet ( wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or NULL if not found.

◆ findLastOfSetOrEnd() [1/2]

static const wchar_t* wcharstring::findLastOfSetOrEnd ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the last occurence in "haystack" of any of the characters in "set" or a pointer to the NULL terminator at the end of the string if not found.

◆ findLastOfSetOrEnd() [2/2]

static wchar_t* wcharstring::findLastOfSetOrEnd ( wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns a pointer to the last occurence in "haystack" of any of the characters in "set". or a pointer to the NULL terminator at the end of the string if not found.

◆ insertString()

static wchar_t* wcharstring::insertString ( const wchar_t *  dest,
const wchar_t *  src,
uint64_t  index 
)
static

Creates a new string with "src" inserted into "dest" at "index".

◆ inSet()

static bool wcharstring::inSet ( const wchar_t *  str,
const wchar_t *const *  set 
)
static

Returns true if "str" is found among the values in the NULL-terminated array "set". Also returns true if "str" is NULL and set is NULL or contains only a NULL-terminator. Otherwise returns false.

◆ inSetIgnoringCase()

static bool wcharstring::inSetIgnoringCase ( const wchar_t *  str,
const wchar_t *const *  set 
)
static

Returns true if "str" is found among the values in the NULL-terminated array "set", ignoring case. Also returns true if "str" is NULL and set is NULL or contains only a NULL-terminator. Otherwise returns false.

◆ integerLength() [1/6]

static uint16_t wcharstring::integerLength ( int16_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ integerLength() [2/6]

static uint16_t wcharstring::integerLength ( int32_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ integerLength() [3/6]

static uint16_t wcharstring::integerLength ( int64_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ integerLength() [4/6]

static uint16_t wcharstring::integerLength ( uint16_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ integerLength() [5/6]

static uint16_t wcharstring::integerLength ( uint32_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ integerLength() [6/6]

static uint16_t wcharstring::integerLength ( uint64_t  number)
static

Returns the number of characters needed to represent "number" as a string.

◆ isInteger() [1/2]

static bool wcharstring::isInteger ( const wchar_t *  val)
static

Returns true if the string "val" is an integer and false if it is not an integer.

◆ isInteger() [2/2]

static bool wcharstring::isInteger ( const wchar_t *  val,
int32_t  size 
)
static

Returns true if the string "val" is an integer and false if it is not an integer.

◆ isNo()

static bool wcharstring::isNo ( const wchar_t *  string)
static

Returns true if "string" starts with the standalone word: "No" (case-insensitive), "False" (case-insensitive), or "0" and false otherwise.

(Eg. returns true for "No,", "False ", and "0 1 2" but returns false for "Nothing", "Falsest", and "012")

◆ isNullOrEmpty()

static bool wcharstring::isNullOrEmpty ( const wchar_t *  string)
static

Returns true if "string" is NULL or the empty string.

◆ isNumber() [1/2]

static bool wcharstring::isNumber ( const wchar_t *  val)
static

Returns true the string "val" is a number and false if it is not a number

◆ isNumber() [2/2]

static bool wcharstring::isNumber ( const wchar_t *  val,
int32_t  size 
)
static

Returns true the string "val" is a number and false if it is not a number

◆ isYes()

static bool wcharstring::isYes ( const wchar_t *  string)
static

Returns true if "string" starts with the standalone "word": "Yes" (case-insensitive), "True" (case-insensitive), "Y" (case-insensitive), "T" (case-insensitive), or "1" and false otherwise.

(Eg. returns true for "Yes,", "True ", and "1 2 3" but returns false for "Yesterday", "Truest", and "123")

◆ leftJustify()

static void wcharstring::leftJustify ( wchar_t *  str,
int32_t  len 
)
static

Moves leading spaces to the end of "str" for "len" characters.

Example: " hello " -> "hello "

◆ leftTrim() [1/2]

static void wcharstring::leftTrim ( wchar_t *  str)
static

Trims all spaces off of the left hand side of "str".

◆ leftTrim() [2/2]

static void wcharstring::leftTrim ( wchar_t *  str,
wchar_t  character 
)
static

Trims all "character"'s off of the left hand side of "str".

◆ length()

static size_t wcharstring::length ( const wchar_t *  string)
static

Returns the number of characters in "string".

◆ lengthContainingSet()

static size_t wcharstring::lengthContainingSet ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns the number of characters, starting at the beginning of "haystack" which consists entirely of characters in "set".

◆ lengthNotContainingSet()

static size_t wcharstring::lengthNotContainingSet ( const wchar_t *  haystack,
const wchar_t *  set 
)
static

Returns the number of characters, starting at the beginning of "haystack" which consists entirely of characters not in "set".

◆ lower()

static void wcharstring::lower ( wchar_t *  str)
static

Converts "str" to lowercase.

◆ pad()

static wchar_t* wcharstring::pad ( const wchar_t *  string,
wchar_t  padchar,
int16_t  direction,
uint64_t  totallength 
)
static

Returns a copy of "string", padded with "padchar" to a character length of "totallength". Set "direction" to -1 to left-pad, 0 to center-pad and 1 to right-pad. Note that this method allocates a buffer internally and returns it. The calling program must deallocate this buffer.

◆ parseNumber() [1/21]

static wchar_t* wcharstring::parseNumber ( double  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [2/21]

static wchar_t* wcharstring::parseNumber ( double  number,
uint16_t  precision,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [3/21]

static wchar_t* wcharstring::parseNumber ( double  number,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [4/21]

static wchar_t* wcharstring::parseNumber ( float  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [5/21]

static wchar_t* wcharstring::parseNumber ( float  number,
uint16_t  precision,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [6/21]

static wchar_t* wcharstring::parseNumber ( float  number,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [7/21]

static wchar_t* wcharstring::parseNumber ( int16_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [8/21]

static wchar_t* wcharstring::parseNumber ( int16_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [9/21]

static wchar_t* wcharstring::parseNumber ( int32_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [10/21]

static wchar_t* wcharstring::parseNumber ( int32_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [11/21]

static wchar_t* wcharstring::parseNumber ( int64_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [12/21]

static wchar_t* wcharstring::parseNumber ( int64_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [13/21]

static wchar_t* wcharstring::parseNumber ( long double  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [14/21]

static wchar_t* wcharstring::parseNumber ( long double  number,
uint16_t  precision,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [15/21]

static wchar_t* wcharstring::parseNumber ( long double  number,
uint16_t  scale 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [16/21]

static wchar_t* wcharstring::parseNumber ( uint16_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [17/21]

static wchar_t* wcharstring::parseNumber ( uint16_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [18/21]

static wchar_t* wcharstring::parseNumber ( uint32_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [19/21]

static wchar_t* wcharstring::parseNumber ( uint32_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [20/21]

static wchar_t* wcharstring::parseNumber ( uint64_t  number)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ parseNumber() [21/21]

static wchar_t* wcharstring::parseNumber ( uint64_t  number,
uint16_t  zeropadding 
)
static

Returns a string representing "number". The string is allocated inside the function and must be deleted by the calling program.

◆ printf() [1/4]

static ssize_t wcharstring::printf ( wchar_t **  buffer,
const wchar_t *  format,
va_list *  argp 
)
static

Allocates "buffer" to sufficient size and writes "argp" to it using "format" which should comply with standard printf formatting rules.

Returns the number of characters written to "buffer" excluding the NULL terminator.

If "buffer" is NULL then nothing is written to "buffer" and 0 is returned.

Returns -1 if an error occurred.

◆ printf() [2/4]

static ssize_t wcharstring::printf ( wchar_t **  buffer,
const wchar_t *  format,
  ... 
)
static

Allocates "buffer" to sufficient size and writes "..." to it using "format" which should comply with standard printf formatting rules.

Returns the number of characters written to "buffer" excluding the NULL terminator.

If "buffer" is NULL then nothing is written to "buffer" and 0 is returned.

Returns -1 if an error occurred.

◆ printf() [3/4]

static ssize_t wcharstring::printf ( wchar_t *  buffer,
size_t  len,
const wchar_t *  format,
va_list *  argp 
)
static

Appends "argp" to "buffer" of character length "len" using "format" which should comply with standard printf formatting rules.

Note that argp is a pointer to a va_list, not just a va_list.

Returns the number of characters written to "buffer" excluding the NULL terminator. If "buffer" wasn't large enough to accommodate the data then it only writes "len" bytes to "buffer" but still returns the number of characters that would have been written had "buffer" been large enough.

If "buffer" is NULL or "len" is 0 then nothing is written to "buffer" but the number of characters that would have been written had "buffer" been large enough is still returned.

Returns -1 if an error occurred.

◆ printf() [4/4]

static ssize_t wcharstring::printf ( wchar_t *  buffer,
size_t  len,
const wchar_t *  format,
  ... 
)
static

Appends "..." to "buffer" of character length "len" using "format" which should comply with standard printf formatting rules.

Returns the number of characters written to "buffer" excluding the NULL terminator. If string wasn't large enough to accommodate the data then it only writes "len" bytes to "buffer" but still returns the number of characters that would have been written had "buffer" been large enough.

If "buffer" is NULL or "len" is 0 then nothing is written to "buffer" but the number of characters that would have been written had "buffer" been large enough is still returned.

Returns -1 if an error occurred.

◆ replace() [1/4]

static wchar_t* wcharstring::replace ( const wchar_t *  str,
const wchar_t *const *  oldstrset,
ssize_t *  oldstrlen,
const wchar_t *const *  newstrset 
)
static

Returns a new string which is a copy of "str" in which all instances of strings found in the NULL-terminated array "oldstrset", the number of characters of which are given by the array "oldstrlen", have been replaced with the commensurate string found in the NULL-terminated array "newstrset", which must have the same number of members as "oldstrset"

◆ replace() [2/4]

static wchar_t* wcharstring::replace ( const wchar_t *  str,
const wchar_t *  oldstr,
const wchar_t *  newstr 
)
static

Returns a new string which is a copy of "str" in which all instances of "oldstr" have been replaced with "newstr"

◆ replace() [3/4]

static void wcharstring::replace ( wchar_t *  str,
const wchar_t *  oldchars,
wchar_t  newchar 
)
static

Replaces all instances of any of the characters in the set "oldchar" in "str" with "newchar"

◆ replace() [4/4]

static void wcharstring::replace ( wchar_t *  str,
wchar_t  oldchar,
wchar_t  newchar 
)
static

Replaces all instances of "oldchar" in "str" with "newchar"

◆ rightJustify()

static void wcharstring::rightJustify ( wchar_t *  str,
int32_t  len 
)
static

Moves trailing spaces to the beginning of "str" for "len" characters.

Example: " hello " -> " hello"

◆ rightTrim() [1/2]

static void wcharstring::rightTrim ( wchar_t *  str)
static

Trims all spaces off of the right hand side of "str".

◆ rightTrim() [2/2]

static void wcharstring::rightTrim ( wchar_t *  str,
wchar_t  character 
)
static

Trims all "character"'s off of the right hand side of "str".

◆ safeCopy() [1/2]

static wchar_t* wcharstring::safeCopy ( wchar_t *  dest,
size_t  destlen,
const wchar_t *  source 
)
static

Replaces "dest" with "source" unless the character length of "source" is greater than "destlen", in which case only "destlen" bytes of "dest" will be replaced. Returns a pointer to "dest".

◆ safeCopy() [2/2]

static wchar_t* wcharstring::safeCopy ( wchar_t *  dest,
size_t  destlen,
const wchar_t *  source,
size_t  sourcesize 
)
static

Replaces "sourcesize" characters of "dest" with "source" unless "sourcesize" is greater than "destlen", in which case only "destlen" characters of "dest" will be replaced. Returns a pointer to "dest".

◆ size()

static size_t wcharstring::size ( const wchar_t *  string)
static

Returns the number of bytes in "string", including the null terminator.

◆ split() [1/4]

static void wcharstring::split ( const wchar_t *  string,
const wchar_t *  delimiter,
bool  collapse,
wchar_t ***  list,
uint64_t *  listlength 
)
static

Parses NULL-terminated "string" delimited by NULL-terminated "delimiter" and allocates "listlength" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.

◆ split() [2/4]

static void wcharstring::split ( const wchar_t *  string,
const wchar_t *  delimiter,
ssize_t  delimiterlength,
bool  collapse,
wchar_t ***  list,
uint64_t *  listlength 
)
static

Parses NULL-terminated "string" delimited by "delimiter" of character length "delimiterlength" and allocates "listlength" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.

◆ split() [3/4]

static void wcharstring::split ( const wchar_t *  string,
ssize_t  stringlength,
const wchar_t *  delimiter,
bool  collapse,
wchar_t ***  list,
uint64_t *  listlength 
)
static

Parses "string" of character length "stringlength" delimited by NULL-terminated "delimiter" and allocates "listlength" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.

◆ split() [4/4]

static void wcharstring::split ( const wchar_t *  string,
ssize_t  stringlength,
const wchar_t *  delimiter,
ssize_t  delimiterlength,
bool  collapse,
wchar_t ***  list,
uint64_t *  listlength 
)
static

Parses "string" of character length "stringlength" delimited by "delimiter" of character length "delimiterlength" and allocates "listlength" elements of "list" to return the parts. If "collapse" is true then multiple instances of the delimiter in a row will be interpreted as one instance of the delimiter. Each member of "list" and "list" itseslf must be deallocated by the calling program.

◆ startsWith()

static bool wcharstring::startsWith ( const wchar_t *  haystack,
const wchar_t *  needle 
)
static

Returns true if "haystack" starts with "needle" or false otherwise.

◆ strip() [1/2]

static bool wcharstring::strip ( wchar_t *  str,
wchar_t  character 
)
static

Strips all instances of "character" from "str". Returns true if any characters were stripped and false if no characters were stripped.

◆ strip() [2/2]

static bool wcharstring::strip ( wchar_t *  str1,
const wchar_t *  str2 
)
static

Strips all instances of "str2" from "str1". Returns true if any characters were stripped and false if no characters were stripped.

◆ stripSet()

static bool wcharstring::stripSet ( wchar_t *  str1,
const wchar_t *  set 
)
static

Strips all instances of any character in "set" from "str1". Returns true if any characters were stripped and false if no characters were stripped.

◆ subString() [1/2]

static wchar_t* wcharstring::subString ( const wchar_t *  str,
size_t  start 
)
static

Returns a copy of the segment of "str" between string index "start" and the end of the string, inclusive.

◆ subString() [2/2]

static wchar_t* wcharstring::subString ( const wchar_t *  str,
size_t  start,
size_t  end 
)
static

Returns a copy of the segment of "str" between string indices "start" and "end", inclusive.

◆ toFloat() [1/2]

static long double wcharstring::toFloat ( const wchar_t *  string)
static

Converts "string" to a floating point number.

◆ toFloat() [2/2]

static long double wcharstring::toFloat ( const wchar_t *  string,
const wchar_t **  endptr 
)
static

Converts "string" to a floating point number. If non-NULL, endptr will be set to the first character in the string after the number.

◆ toFloatC()

static long double wcharstring::toFloatC ( const wchar_t *  string)
static

Converts "string" to a floating point number.

If "string" uses a "." as a decimal point (per the "C" locale) then the "." is first converted to the appropriate decimal-delimiter for the current locale.

(Currently only supported on linux/unix platforms that provide the locale.h header. On other platforms, it just falls through to toFloat().)

◆ toInteger() [1/4]

static int64_t wcharstring::toInteger ( const wchar_t *  string)
static

Converts "string" to a 64-bit integer.

◆ toInteger() [2/4]

static int64_t wcharstring::toInteger ( const wchar_t *  string,
const wchar_t **  endptr 
)
static

Converts "string" to a 64-bit integer. If non-NULL, endptr will be set to the first character in the string after the number.

◆ toInteger() [3/4]

static int64_t wcharstring::toInteger ( const wchar_t *  string,
const wchar_t **  endptr,
int32_t  base 
)
static

Converts "string" to a 64-bit integer of base "base". If non-NULL, endptr will be set to the first character in the string after the number.

◆ toInteger() [4/4]

static int64_t wcharstring::toInteger ( const wchar_t *  string,
int32_t  base 
)
static

Converts "string" to a 64-bit integer of base "base".

◆ toUnsignedInteger() [1/4]

static uint64_t wcharstring::toUnsignedInteger ( const wchar_t *  string)
static

Converts "string" to a 64-bit unsigned integer.

◆ toUnsignedInteger() [2/4]

static uint64_t wcharstring::toUnsignedInteger ( const wchar_t *  string,
const wchar_t **  endptr 
)
static

Converts "string" to a 64-bit unsigned integer. If non-NULL, endptr will be set to the first character in the string after the number.

◆ toUnsignedInteger() [3/4]

static uint64_t wcharstring::toUnsignedInteger ( const wchar_t *  string,
const wchar_t **  endptr,
int32_t  base 
)
static

Converts "string" to a 64-bit unsigned integer of base "base". If non-NULL, endptr will be set to the first character in the string after the number.

◆ toUnsignedInteger() [4/4]

static uint64_t wcharstring::toUnsignedInteger ( const wchar_t *  string,
int32_t  base 
)
static

Converts "string" to a 64-bit unsigned integer of base "base".

◆ unescape() [1/2]

static wchar_t* wcharstring::unescape ( const wchar_t *  input)
static

unescapes all -escaped characters found in "input" and returns the result in a buffer allocated inside the function. This buffer must be deleted by the calling program.

◆ unescape() [2/2]

static void wcharstring::unescape ( const wchar_t *  input,
uint64_t  inputsize,
wchar_t **  output,
uint64_t *  outputsize 
)
static

similar to unescape() above, but takes an "inputsize" parameter and returns the result in "output" and "outputsize" rather than in a return value

◆ upper()

static void wcharstring::upper ( wchar_t *  str)
static

Converts "str" to uppercase.

◆ zero()

static void wcharstring::zero ( wchar_t *  str,
size_t  len 
)
static

Sets "len" characters of "str" to NULL.