#include <const_super_string.hpp>
Public Member Functions | |
basic_const_super_string | append_file (const std_string_type &filepath) const |
Make a string from the contents of a file. | |
bool | contains_regex (const base_string_type &s) const |
Query function using regular expression. | |
bool | contains (const base_string_type &s) const |
Query function to see if a string contains given string. | |
bool | starts_with (const base_string_type &s, size_type offset=0) const |
Query function to see if a string or substring starts with a given string. | |
bool | ends_with (const base_string_type &s) const |
Query function to see if a string or substring ends with a given string. | |
bool | icontains (const base_string_type &s) const |
Case insensitive query function to see if a string contains a given string. | |
bool | istarts_with (const base_string_type &s, size_type offset=0) const |
Case insensitive query function to see if a string or substring starts with a given string. | |
bool | iends_with (const base_string_type &s) const |
Case insensitive query function to see if a string or substring ends with a given string. | |
unsigned int | split (const base_string_type &predicate, string_vector &result) const |
Split a string into a string of vectors based on equality to a string. | |
unsigned int | split_regex (const base_string_type &predicate_regex, string_vector &result) const |
Split a string into a string of vectors based regex string. | |
basic_const_super_string | replace_all_regex (const base_string_type &match_regex, const base_string_type &replace_regex) const |
Replace the all instance of the match_string with the replace_format. | |
basic_const_super_string | replace_first (const base_string_type &match_string, const base_string_type &replace_string) const |
Replace the first instance of the match_string with the replace_string Has no effect on the string if there is match_string does not appear in the string. | |
basic_const_super_string | replace_last (const base_string_type &match_string, const base_string_type &replace_string) const |
Replace the last instance of the match_string with the replace_string Has no effect on the string if there is match_string does not appear in the string. | |
basic_const_super_string | replace_nth (const base_string_type &match_string, const base_string_type &replace_string, size_type n) const |
Replace the nth instance of the match_string with the replace_string Has no effect on the string if there is no 'nth' version of the match string. | |
basic_const_super_string | replace_all (const base_string_type &match_string, const base_string_type &replace_string) const |
Replace the all instance of the match_string with the replace_string Has no effect on the string if there are no instances of match_string in the string. | |
basic_const_super_string | ireplace_first (const base_string_type &match_string, const base_string_type &replace_string) const |
Case insensitive replace the first instance of the match_string with the replace_string. | |
basic_const_super_string | ireplace_last (const base_string_type &match_string, const base_string_type &replace_string) const |
Case insensitive replace of the last instance of the match_string with the replace_string. | |
basic_const_super_string | ireplace_nth (const base_string_type &match_string, const base_string_type &replace_string, size_type n) const |
Case insensitive replace of the nth instance of the match_string with the replace_string. | |
basic_const_super_string | ireplace_all (const base_string_type &match_string, const base_string_type &replace_string) const |
Case insensitive replace the all instance of the match_string with the replace_string Has no effect on the string if there are no instances of match_string in the string. | |
basic_const_super_string | trim () const |
Trim whitespace from the both sides of the string making a copy. | |
basic_const_super_string | trim_left () const |
Trim whitespace from the left side of the string making a copy. | |
basic_const_super_string | trim_right () const |
Trim whitespace from the right side of the string making a copy. | |
basic_const_super_string | to_lower () const |
Change to lower case using the global locale The global local can be replaced by calling std::global(locale). | |
basic_const_super_string | to_upper () const |
Change to upper case using the global locale The global local can be replaced by calling std::global(locale). | |
template<typename T> | |
basic_const_super_string< char_type > | append (const T &value) const |
Generic function to append any type to the string This function will work with any type that is OutputStreamable. | |
template<typename T1, typename T2> | |
basic_const_super_string< char_type > | append (const T1 &val1, const T2 &val2) const |
Generic function to append 2 values This function will work with any type that is OutputStreamable. | |
template<typename T1, typename T2, typename T3> | |
basic_const_super_string< char_type > | append (const T1 &val1, const T2 &val2, const T3 &val3) const |
Generic function to append 3 values This function will work with any type that is OutputStreamable. | |
template<typename T1, typename T2, typename T3, typename T4> | |
basic_const_super_string< char_type > | append (const T1 &val1, const T2 &val2, const T3 &val3, const T4 &val4) const |
Generic function to append 4 values This function will work with any type that is OutputStreamable. | |
template<typename T1, typename T2, typename T3, typename T4, typename T5> | |
basic_const_super_string< char_type > | append (const T1 &val1, const T2 &val2, const T3 &val3, const T4 &val4, const T5 &val5) const |
Generic function to append 5 values This function will work with any type that is OutputStreamable. | |
template<class T> | |
basic_const_super_string< char_type > | prepend (const T &value) const |
Generic function to prepend any type to the string This function will work with any type that is OutputStreamable. | |
template<class T> | |
basic_const_super_string< char_type > | insert_at (size_type pos, const T &value) const |
Generic function to insert an OutputStreamable type into the string. | |
template<typename T> | |
basic_const_super_string< char_type > | append_formatted (const T &value, const base_string_type &fmt) const |
Generic function to append any type to the string including formatting. | |
template<typename T1, typename T2> | |
basic_const_super_string< char_type > | append_formatted (const T1 &val1, const T2 &val2, const base_string_type &fmt) const |
Generic function to append 2 values of any to the string including formatting. | |
template<typename T1, typename T2, typename T3> | |
basic_const_super_string< char_type > | append_formatted (const T1 &val1, const T2 &val2, const T3 &val3, const base_string_type &fmt) const |
Generic function to append 3 values of any to the string including formatting. | |
template<typename T1, typename T2, typename T3, typename T4> | |
basic_const_super_string< char_type > | append_formatted (const T1 &val1, const T2 &val2, const T3 &val3, const T4 &val4, const base_string_type &fmt) const |
Generic function to append 4 values of any to the string including formatting. | |
template<typename T1, typename T2, typename T3, typename T4, typename T5> | |
basic_const_super_string< char_type > | append_formatted (const T1 &val1, const T2 &val2, const T3 &val3, const T4 &val4, const T5 &val5, const base_string_type &fmt) const |
Generic function to append 5 values of any to the string including formatting. |
|
Generic function to append 5 values This function will work with any type that is OutputStreamable.
super_string s; double dbl = 1.543; int i = 10; s.append("value is: ", dbl, " int: ", i); //s == "double: 1.543 int: 10"
|
|
Generic function to append 4 values This function will work with any type that is OutputStreamable.
super_string s; double dbl = 1.543; int i = 10; s.append("value is: ", dbl, " int: ", i); //s == "double: 1.543 int: 10"
|
|
Generic function to append 3 values This function will work with any type that is OutputStreamable.
super_string s; double dbl = 1.543; int i = 10; s.append("value is: ", dbl, i); //s == "double: 1.54310"
|
|
Generic function to append 2 values This function will work with any type that is OutputStreamable.
super_string s; double dbl = 1.543; s.append("double: ", dbl); //s == "double: 1.543"
|
|
Generic function to append any type to the string This function will work with any type that is OutputStreamable.
super_string s; double dbl = 1.543; s.append(dbl); s += " - "; //std::string method //append a date to the string boost::gregorian::date d(2006, boost::gregorian::Jun, 29); s.append(d); //s == "1.543 - 2006-Jun-29"
|
|
Make a string from the contents of a file.
super_string data; data.append_file("data1.txt").append_file(data2.txt); *
|
|
Generic function to append 5 values of any to the string including formatting.
super_string s; double dbl = 1.123456789; int i = 1000; s.append_formatted(dbl, i , dbl, i, "a string", "%-7.2f %-7d %-7.2f %-7d %s"); //s == "1.12 1000 1.12 1000 a string" - The value to append to the end of the string. - Formatting string for the value.
|
|
Generic function to append 4 values of any to the string including formatting.
super_string s; double dbl = 1.123456789; int i = 1000; s.append_formatted(dbl, i , dbl, i, "%-7.2f %-7d %-7.2f %-7d"); //s == "1.12 1000 1.12 1000 " - The value to append to the end of the string. - Formatting string for the value.
|
|
Generic function to append 3 values of any to the string including formatting.
super_string s; double dbl = 1.123456789; int i = 1000; s.append_formatted(dbl, dbl, i , "%-7.2f %-7.2f %-7d"); //s == "1.23 1.23 1000 " - The value to append to the end of the string. - Formatting string for the value.
|
|
Generic function to append 2 values of any to the string including formatting.
super_string s; double dbl = 1.123456789; s.append_formatted(dbl, "some string", "%-7.2f %s" ); //s == "1.12 some string" - The value to append to the end of the string. - Formatting string for the value.
|
|
Generic function to append any type to the string including formatting.
super_string s; double dbl = 1.123456789; s.append_fmt(dbl, "%-7.2f"); s += " - "; //std::string method //s == "1.543 - 2006-Jun-29" - The value to append to the end of the string. - Formatting string for the value.
|
|
Query function to see if a string contains given string.
|
|
Query function using regular expression.
super_string s("hello 2006-02-23"); s.contains_regex("\\d{4}-\\d{2}-\\d{2}")); //true s.contains_regex("[A-Z]")); //false
|
|
Query function to see if a string or substring ends with a given string.
|
|
Case insensitive query function to see if a string contains a given string.
|
|
Case insensitive query function to see if a string or substring ends with a given string.
super_string s("hELlo"); s.iends_with("llO"); //true s.iends_with("Hi") //false
|
|
Generic function to insert an OutputStreamable type into the string.
super_string s( "Hello There"); double dbl = 1.543; s.prepend(dbl); //s == "Hello 1.543 There"
|
|
Case insensitive replace the all instance of the match_string with the replace_string Has no effect on the string if there are no instances of match_string in the string.
super_string s("foo FOO Foo"); s.ireplace_all("foo", "bar", 1); //s == "bar bar bar"
|
|
Case insensitive replace the first instance of the match_string with the replace_string. Has no effect on the string if there match_string does not appear in the string. super_string s("FOO foo foo"); s.ireplace_first("foo", "bar"); //s == "bar foo foo"
|
|
Case insensitive replace of the last instance of the match_string with the replace_string. Has no effect on the string if there match_string does not appear in the string. super_string s("foo foo FOO"); s.ireplace_last("foo", "bar"); //s == "foo foo bar"
|
|
Case insensitive replace of the nth instance of the match_string with the replace_string. Has no effect on the string if there is no 'nth' version of the match string. super_string s("foo FOO foo"); s.ireplace_nth("foo", "bar", 1); //s == "foo bar foo"
|
|
Case insensitive query function to see if a string or substring starts with a given string.
super_string s("hELlo"); s.istarts_with("el", 1); //returns true *
|
|
Generic function to prepend any type to the string This function will work with any type that is OutputStreamable.
super_string s( "Hello There"); double dbl = 1.543; s.prepend(dbl); //s == "1.543 Hello There"
|
|
Replace the all instance of the match_string with the replace_string Has no effect on the string if there are no instances of match_string in the string.
super_string s("foo foo foo"); s.replace_all("foo", "bar", 1); //s == "bar bar bar"
|
|
Replace the all instance of the match_string with the replace_format.
super_string s("(abc)3333()(456789) [123] (1) (cde)"); //replace parens around digits with #--the digits--# s = s.replace_all_regex("\\(([0-9]+)\\)", "#--$1--#"); //s == "(abc)3333()#--456789--# [123] #--1--# (cde)"
|
|
Replace the first instance of the match_string with the replace_string Has no effect on the string if there is match_string does not appear in the string.
super_string s("foo foo foo"); s.replace_first("foo", "bar"); //s == "bar foo foo"
|
|
Replace the last instance of the match_string with the replace_string Has no effect on the string if there is match_string does not appear in the string.
super_string s("foo foo foo"); s.replace_last("foo", "bar"); //s == "foo foo bar"
|
|
Replace the nth instance of the match_string with the replace_string Has no effect on the string if there is no 'nth' version of the match string.
super_string s("foo foo foo"); s.replace_nth("foo", "bar", 1); //s == "foo bar foo"
|
|
Split a string into a string of vectors based on equality to a string.
super_string stuff("first-|-second-|-third"); super_string::string_vector out_vec; if (stuff.split("-|-", out_vec)) { //iterate thru the vector and process //out_vec[0] == first //out_vec[1] == second //out_vec[2] == third } *
|
|
Split a string into a string of vectors based regex string.
super_string s("These are some \t words--with whitespace"); super_string::string_vector out_vec; unsigned int count = s.split_regex("\\s+|--", out_vec); if (count) { //iterate thru the vector and process //out_vec[0] == These //out_vec[4] == with } *
|
|
Query function to see if a string or substring starts with a given string.
|
|
Change to lower case using the global locale The global local can be replaced by calling std::global(locale).
|
|
Change to upper case using the global locale The global local can be replaced by calling std::global(locale).
|
|
Trim whitespace from the both sides of the string making a copy.
|