![]() |
RedFlame v0.1.1
A high intensity flame eminating from software
|
Some useful static functions for working with std::strings. More...
#include <StringUtils.h>
Static Public Member Functions | |
Modifers | |
static std::string | toUpper (const std::string &s1) |
static std::string | toLower (const std::string &s1) |
static void | trim (std::string &s1, const std::string &s2=StringUtils::whiteSpace) |
static void | trim (std::string &s1, const char *pChars) |
static void | trim (std::string &s1, char c) |
static void | trimFront (std::string &s1, const std::string &s2=StringUtils::whiteSpace) |
static void | trimFront (std::string &s1, const char *pChars) |
static void | trimFront (std::string &s1, char c) |
static void | trimEnd (std::string &s1, const std::string &s2=StringUtils::whiteSpace) |
static void | trimEnd (std::string &s1, const char *pChars) |
static void | trimEnd (std::string &s1, char c) |
static void | prepend (std::string &s1, const std::string &s2) |
static void | prepend (std::string &s1, const char *pChars) |
static void | prepend (std::string &s1, char c) |
static void | replace (std::string &s1, const std::string &oldSubstring, const std::string &newSubstring) |
static void | replace (std::string &s1, const char *oldSubstring, const char *newSubstring) |
Observers | |
static std::string | toString (const char *pFmt,...) |
static bool | startsWith (const std::string &s1, const std::string &s2) |
static bool | startsWith (const std::string &s1, const char *pChars) |
static bool | startsWith (const std::string &s1, char c) |
static bool | startsWithAnyOf (const std::string &s1, const std::string &s2) |
static bool | startsWithAnyOf (const std::string &s1, const char *pChars) |
static bool | endsWith (const std::string &s1, const std::string &s2) |
static bool | endsWith (const std::string &s1, const char *pChars) |
static bool | endsWith (const std::string &s1, char c) |
static bool | endsWithAnyOf (const std::string &s1, const std::string &s2) |
static bool | endsWithAnyOf (const std::string &s1, const char *pChars) |
static bool | containsAnyOf (const std::string &s1, const std::string &s2) |
static bool | containsAnyOf (const std::string &s1, const char *pChars) |
static bool | insensitiveEquals (const std::string &s1, const std::string &s2) |
static bool | insensitivePredicate (const std::string::value_type &s1, const std::string::value_type &s2) |
static int | countCharInString (const std::string &s1, char c) |
Static Public Attributes | |
static const std::string | whiteSpace |
these chars " \t\v\f\r\n" | |
Some useful static functions for working with std::strings.
Most of these functions change the string in-place.
|
inlinestatic |
Determine if a string contains any characters in the given C-style string.
[in] | s1 | The string to operate on. |
[in] | pChars | The C-style string to look for in s1. |
|
static |
Determine if a string contains any characters in the given string.
[in] | s1 | The string to operate on. |
[in] | any | The characters to look for in s. |
|
static |
Return the total number of occurrences of c in s1.
[in] | s1 | The string to operate on. |
[in] | c | The character to count. |
|
inlinestatic |
Determine if the string ends with the given character.
[in] | s1 | The string to operate on. |
[in] | c | The character to look for. |
|
inlinestatic |
Determine if the string ends with the given C-style string.
[in] | s1 | The string to operate on. |
[in] | pChars | The C-style string to look for. |
|
static |
Determine if the string ends with the given string.
[in] | s1 | The string to operate on. |
[in] | s2 | The string to look for. |
|
inlinestatic |
Determine if a string ends with any of the characters in the given C-style string.
[in] | s1 | The string to operate on. |
[in] | pChars | The characters to look for as a C-style. |
|
static |
Determine if a string ends with any of the characters in a given string.
[in] | s1 | The string to operate on. |
[in] | any | The characters to look for as a std::string. |
|
static |
Case insensitive comparison of two string objects.
[in] | s1 | The first string to use for comparison. |
[in] | s2 | The second string to use for comparison. |
|
static |
Predicate for insensitive comparison of string objects.
[in] | s1 | The first character to use for comparison. |
[in] | s2 | The second character to use for comparison. |
|
inlinestatic |
Prepend character c to the string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | c | The character to prepend. |
|
inlinestatic |
Prepend C-style string to the string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | pChars | The C-style string to prepend. |
|
inlinestatic |
Prepend string s2 to s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | s2 | The string to prepend. |
|
inlinestatic |
Replace all occurences of one substring with another.
[in,out] | s1 | The string to operate on. |
[in] | substringOld | The C-style substring within s1 that needs replacing. |
[in] | substringNew | The C-style replacement substring. |
|
static |
Replace all occurences of one substring with another.
[in,out] | s1 | The string to operate on. |
[in] | substringOld | The substring within s that needs replacing. |
[in] | substringNew | The replacement substring. |
|
inlinestatic |
Determine if a string starts with the given character.
[in] | s1 | The string to search. |
[in] | c | The character to look for. |
|
inlinestatic |
Determine if a string starts with the given C-style string.
[in] | s1 | The string to search. |
[in] | pChars | The C-style string to look for. |
|
static |
Determine if a string starts with the given string.
[in] | s1 | The string to operate on. |
[in] | s2 | The string to look for. |
|
inlinestatic |
Determine if a string starts with any of the characters in a given C-style string.
[in] | s1 | The string to operator on. |
[in] | pChars | The characters to look for as a C-style string. |
|
static |
Determine if a string starts with any of the characters in a given string.
[in] | s1 | The string to operate on. |
[in] | any | The characters to look for as a std::string. |
|
static |
Returns a new string converted to lower case.
[in] | s1 | The string to convert. |
|
static |
Returns a std::string formated with printf style arguments.
[in] | pFmt | The format specification. |
|
static |
Returns a new string converted to upper case.
[in] | s1 | The string to convert. |
|
static |
Removes the given character from the front and back of string in-place.
[in,out] | s1 | The string to operate on. |
[in] | c | The character to remove. |
|
static |
Removes the C-style substring from the front and back of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | pChars | The C-style substring to remove. |
|
static |
Removes the substring s2 from the front and back of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | s2 | The substring to remove. |
|
inlinestatic |
Removes the character from the end of string s1 in-place.
[in,out] | s1 | The string to operator on. |
[in] | c | The character to remove. |
|
inlinestatic |
Removes the C-style string from the end of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | pChars | The C-style string to remove. |
|
static |
Removes the substring s2 from the back of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | s2 | The substring to remove. |
|
inlinestatic |
Removes the character c from the front of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | c | The character to remove. |
|
inlinestatic |
Removes the C-style string from the front of string s1 in-place.
[in,out] | s1 | The string to operator on. |
[in] | pChars | The character to remove. |
|
static |
Removes the substring s2 from the front of string s1 in-place.
[in,out] | s1 | The string to operate on. |
[in] | s2 | The substring to remove. |