utx::str_rep is a template class alias, used to replace a substring of a string to another substring.
auto rep = utx::str_rep{a_string_view};
Default constructor is removed, as it must hold a string_view.
str_rep_class() = delete;
Replace all sub-string found to another sub-string.
This member function will not affect the original string held in the object.
auto result_string = rep.replace(a_sub_strinng, another_sub_string);
Replace the first found sub-string to another sub-string.
This member function will not affect the original string held in the object.
auto result_string = rep.replace_first(a_sub_string, another_sub_string);
Replace the last found sub-string to another sub-string.
This member function will not affect the original string held in the object.
auto result_string = rep.replace_last(a_sub_string, another_sub_string);
Replace a sub-string found by index__~th to another sub-string.
This member function will not affect the original string held in the object.
auto result_string = rep.replace_at(index__, a_sub_string, another_sub_string);
Reverse-replace a sub-string found by index__~th to another sub-string.
This member function will not affect the original string held in the object.
auto result_string = rep.r_replace_at(index__, a_sub_string, another_sub_string);
c++ example
#include <utxcpp/core.hpp> int main() { auto r1 = utx::str_rep{"No news is good news."}.replace("news", "place"); utx::print(r1); // No place is good place. }