PrevUpHomeNext

esv::str_rep


Love life, stop killing.

esv::str_rep

esv::str_rep is a template class alias, used to replace a substring of a string to another substring.

constructor

Calling Sig:

auto rep = esv::str_rep{a_string_view};

Default constructor is removed, as it must hold a string_view.

str_rep_class() = delete;

Method: .replace

Replace all sub-string found to another sub-string.

This member function will not affect the original string held in the object.

Calling Sig:

auto result_string = rep.replace(a_sub_strinng, another_sub_string);

Method: .replace_first

Replace the first found sub-string to another sub-string.

This member function will not affect the original string held in the object.

Calling Sig:

auto result_string = rep.replace_first(a_sub_string, another_sub_string);

Method: .replace_last

Replace the last found sub-string to another sub-string.

This member function will not affect the original string held in the object.

Calling Sig:

auto result_string = rep.replace_last(a_sub_string, another_sub_string);

Method: .replace_at

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.

Calling Sig:

auto result_string = rep.replace_at(index__, a_sub_string, another_sub_string);

Method: .r_replace_at

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.

Calling Sig:

auto result_string = rep.r_replace_at(index__, a_sub_string, another_sub_string);

cpp example

c++ example

#include <esvcpp/core.hpp>

int main()
{
	auto r1 = esv::str_rep{"No news is good news."}.replace("news", "place");
	esv::print(r1);	// No place is good place.
}

See Also

esv::wstr_rep

esv::print


PrevUpHomeNext

esv::print