|
| static bool | replace (std::string &s, const std::string &from, const std::string &to, size_type *pos_p=nullptr) |
| | Replaces 'from' with 'to', starting at offset '*pos_p'. More...
|
| |
| static unsigned int | replaceAll (std::string &s, const std::string &from, const std::string &to) |
| | Does a global replace on string 's', replacing all occurances of sub-string 'from' with 'to'. More...
|
| |
|
static unsigned int | replaceAll (std::string &s, const char *from, const char *to) |
| | A c-string overload, provided for performance reasons.
|
| |
|
static void | removeAll (std::string &, char) |
| | Removes all occurrences of the character from the string.
|
| |
|
static void | trimLeft (std::string &s, const std::string &ws, size_type limit=0U) |
| | Trims the lhs of s, taking off up to 'limit' of the 'ws' characters.
|
| |
|
static void | trimRight (std::string &s, const std::string &ws, size_type limit=0U) |
| | Trims the rhs of s, taking off up to 'limit' of the 'ws' characters.
|
| |
|
static void | trim (std::string &s, const std::string &ws) |
| | Trims both ends of s, taking off any of the 'ws' characters.
|
| |
|
static std::string | trimmed (const std::string &s, const std::string &ws) |
| | Returns a trim()med version of s.
|
| |
| static bool | isNumeric (const std::string &s, bool allow_minus_sign=false) |
| | Returns true if every character is a decimal digit. More...
|
| |
| static bool | isPrintableAscii (const std::string &s) |
| | Returns true if every character is a 7-bit, non-control character (ie. More...
|
| |
| static bool | isUShort (const std::string &s) |
| | Returns true if the string can be converted into an unsigned short without throwing an exception. More...
|
| |
| static bool | isUInt (const std::string &s) |
| | Returns true if the string can be converted into an unsigned integer without throwing an exception. More...
|
| |
| static bool | isULong (const std::string &s) |
| | Returns true if the string can be converted into an unsigned long without throwing an exception. More...
|
| |
| static bool | isInt (const std::string &s) |
| | Returns true if the string can be converted into an integer without throwing an exception. More...
|
| |
|
static std::string | fromBool (bool b) |
| | Converts boolean 'b' to a string.
|
| |
|
static std::string | fromDouble (double d) |
| | Converts double 'd' to a string.
|
| |
|
static std::string | fromInt (int i) |
| | Converts int 'i' to a string.
|
| |
|
static std::string | fromLong (long l) |
| | Converts long 'l' to a string.
|
| |
|
static std::string | fromShort (short s) |
| | Converts short 's' to a string.
|
| |
|
static std::string | fromUInt (unsigned int ui) |
| | Converts unsigned int 'ui' to a string.
|
| |
|
static std::string | fromULong (unsigned long ul) |
| | Converts unsigned long 'ul' to a string.
|
| |
|
static std::string | fromUShort (unsigned short us) |
| | Converts unsigned short 'us' to a string.
|
| |
| static bool | toBool (const std::string &s) |
| | Converts string 's' to a bool. More...
|
| |
| static double | toDouble (const std::string &s) |
| | Converts string 's' to a double. More...
|
| |
| static int | toInt (const std::string &s) |
| | Converts string 's' to an int. More...
|
| |
| static long | toLong (const std::string &s) |
| | Converts string 's' to a long. More...
|
| |
| static short | toShort (const std::string &s) |
| | Converts string 's' to a short. More...
|
| |
| static unsigned int | toUInt (const std::string &s) |
| | Converts string 's' to an unsigned int. More...
|
| |
| static unsigned int | toUInt (const std::string &s, Limited) |
| | Converts string 's' to an unsigned int. More...
|
| |
| static unsigned int | toUInt (const std::string &s1, const std::string &s2) |
| | Overload that converts the first string if it can be converted without throwing, or otherwise the second string. More...
|
| |
| static unsigned long | toULong (const std::string &s, Limited) |
| | Converts string 's' to an unsigned long. More...
|
| |
| static unsigned long | toULong (const std::string &s) |
| | Converts string 's' to an unsigned long. More...
|
| |
| static unsigned short | toUShort (const std::string &s, Limited) |
| | Converts string 's' to an unsigned short. More...
|
| |
| static unsigned short | toUShort (const std::string &s) |
| | Converts string 's' to an unsigned short. More...
|
| |
| static void | toUpper (std::string &s) |
| | Replaces all Latin-1 lowercase characters in string 's' by uppercase characters. More...
|
| |
| static void | toLower (std::string &s) |
| | Replaces all Latin-1 uppercase characters in string 's' by lowercase characters. More...
|
| |
| static std::string | upper (const std::string &s) |
| | Returns a copy of 's' in which all Latin-1 lowercase characters have been replaced by uppercase characters. More...
|
| |
| static std::string | lower (const std::string &s) |
| | Returns a copy of 's' in which all Latin-1 uppercase characters have been replaced by lowercase characters. More...
|
| |
|
static std::string | toPrintableAscii (char c, char escape= '\\') |
| | Returns a 7-bit printable representation of the given input character.
|
| |
|
static std::string | toPrintableAscii (const std::string &in, char escape= '\\') |
| | Returns a 7-bit printable representation of the given input string.
|
| |
|
static std::string | toPrintableAscii (const std::wstring &in, wchar_t escape=L'\\') |
| | Returns a 7-bit printable representation of the given wide input string.
|
| |
| static std::string | printable (const std::string &in, char escape= '\\') |
| | Returns a printable represention of the given input string. More...
|
| |
| static void | escape (std::string &s, char c_escape, const std::string &specials_in, const std::string &specials_out) |
| | Prefixes each occurrence of one of the special-in characters with the escape character and its corresponding special-out character. More...
|
| |
|
static void | escape (std::string &s, char c_escape, const char *specials_in, const char *specials_out) |
| | Overload for c-style 'special' strings.
|
| |
|
static void | escape (std::string &s) |
| | Overload for 'normal' backslash escaping of whitespace.
|
| |
|
static std::string | escaped (const std::string &, char c_escape, const std::string &specials_in, const std::string &specials_out) |
| | Returns the escape()d string.
|
| |
|
static std::string | escaped (const std::string &, char c_escape, const char *specials_in, const char *specials_out) |
| | Returns the escape()d string.
|
| |
|
static std::string | escaped (const std::string &) |
| | Returns the escape()d string.
|
| |
| static void | unescape (std::string &s, char c_escape, const char *specials_in, const char *specials_out) |
| | Unescapes the string by replacing e-e with e, e-special-in with special-out, and e-other with other. More...
|
| |
| static void | unescape (std::string &s) |
| | Overload for "normal" unescaping where the string has backslash escaping of whitespace. More...
|
| |
|
static std::string | unescaped (const std::string &s) |
| | Returns the unescape()d version of s.
|
| |
| static std::string | meta () |
| | Returns a list of shell meta-characters with a tilde as the first character. More...
|
| |
| static std::string | readLineFrom (std::istream &stream, const std::string &eol=std::string()) |
| | Reads a line from the stream using the given line terminator. More...
|
| |
|
static void | readLineFrom (std::istream &stream, const std::string &eol, std::string &result, bool pre_erase_result=true) |
| | An overload which avoids string copying.
|
| |
| static std::string | wrap (std::string text, const std::string &prefix_first_line, const std::string &prefix_subsequent_lines, size_type width=70U) |
| | Does word-wrapping. More...
|
| |
| static void | splitIntoTokens (const std::string &in, StringArray &out, const std::string &ws) |
| | Splits the string into 'ws'-delimited tokens. More...
|
| |
|
static StringArray | splitIntoTokens (const std::string &in, const std::string &ws=Str::ws()) |
| | Overload that returns by value.
|
| |
| static void | splitIntoFields (const std::string &in, StringArray &out, const std::string &separators, char escape= '\0', bool remove_escapes=true) |
| | Splits the string into fields. More...
|
| |
|
static StringArray | splitIntoFields (const std::string &in, const std::string &ws=Str::ws()) |
| | Overload that returns by value.
|
| |
| static std::string | dequote (const std::string &, char qq= '\"' , char esc = '\\' , const std::string & ws = Str::ws() ) |
| | Dequotes a string by removing unescaped quotes and escaping quoted whitespace, so "qq-aaa-esc-qq-bbb-ws-ccc-qq" becomes "aaa-qq-bbb-esc-ws-ccc". More...
|
| |
|
static std::string | join (const std::string &sep, const StringArray &strings) |
| | Concatenates an array of strings with separators.
|
| |
|
static std::string | join (const std::string &sep, const std::set< std::string > &strings) |
| | Concatenates a set of strings with separators.
|
| |
| static std::string | join (const std::string &sep, const std::string &s1, const std::string &s2, const std::string &s3=std::string(), const std::string &s4=std::string(), const std::string &s5=std::string(), const std::string &s6=std::string(), const std::string &s7=std::string(), const std::string &s8=std::string(), const std::string &s9=std::string()) |
| | Concatenates a small number of strings with separators. More...
|
| |
|
static std::string | join (const std::string &sep, const StringMap &, const std::string &eq=std::string(1U,'='), const std::string &tail=std::string()) |
| | Contatenates entries in a map, where an entry is "<key><eq><value><tail>".
|
| |
|
static std::set< std::string > | keySet (const StringMap &string_map) |
| | Extracts the keys from a map of strings.
|
| |
| static std::string | head (const std::string &in, size_type pos, const std::string &default_=std::string()) |
| | Returns the first part of the string up to just before the given position. More...
|
| |
| static std::string | head (const std::string &in, const std::string &sep, bool default_empty=true) |
| | Overload taking a separator string, and with the default as either the input string or the empty string. More...
|
| |
| static std::string | tail (const std::string &in, size_type pos, const std::string &default_=std::string()) |
| | Returns the last part of the string after the given position. More...
|
| |
| static std::string | tail (const std::string &in, const std::string &sep, bool default_empty=true) |
| | Overload taking a separator string, and with the default as either the input string or the empty string. More...
|
| |
|
static bool | match (const std::string &, const std::string &) |
| | Returns true if the two strings are the same.
|
| |
|
static bool | match (const StringArray &, const std::string &) |
| | Returns true if any string in the array matches the given string.
|
| |
| static bool | imatch (const std::string &, const std::string &) |
| | Returns true if the two strings are the same, ignoring Latin-1 case. More...
|
| |
| static bool | imatch (const StringArray &, const std::string &) |
| | Returns true if any string in the array matches the given string, ignoring Latin-1 case. More...
|
| |
|
static bool | tailMatch (const std::string &in, const std::string &ending) |
| | Returns true if the string has the given ending (or ending is empty).
|
| |
| static bool | tailMatch (const StringArray &in, const std::string &ending) |
| | Returns true if any string in the array has the given ending (or ending is empty). More...
|
| |
|
static bool | headMatch (const std::string &in, const std::string &head) |
| | Returns true if the string has the given start (or head is empty).
|
| |
| static bool | headMatch (const StringArray &in, const std::string &head) |
| | Returns true if any string in the array has the given start (or head is empty). More...
|
| |
| static std::string | headMatchResidue (const StringArray &in, const std::string &head) |
| | Returns the unmatched part of the first string in the array that has the given start. More...
|
| |
|
static std::string | ws () |
| | Returns a string of standard whitespace characters.
|
| |
|
static std::string | positive () |
| | Returns a default positive string. See isPositive().
|
| |
|
static std::string | negative () |
| | Returns a default negative string. See isNegative().
|
| |
|
static bool | isPositive (const std::string &) |
| | Returns true if the string has a positive meaning, such as "1", "true", "yes".
|
| |
|
static bool | isNegative (const std::string &) |
| | Returns true if the string has a negative meaning, such as "0", "false", "no".
|
| |
| static size_type | ifind (const std::string &s, const std::string &key, size_type pos=0U) |
| | Returns the position of the key in 's' using a Latin-1 case-insensitive search. More...
|
| |
| static std::string | unique (std::string s, char c= ' ', char r= ' ') |
| | Returns a string with repeated 'c' characters replaced by one 'r' character. More...
|
| |