![]() |
General Utility Library for C++17 25.4.1
|
Replacing all occurrences of a string within another string.
Functions | |
GUL_EXPORT std::string | gul17::replace (std::string_view haystack, std::string_view needle, std::string_view hammer) |
Replace all occurrences of a string within another string, returning the result as a std::string. | |
GUL_EXPORT std::string & | gul17::replace_inplace (std::string &haystack, std::string_view needle, std::string_view hammer) |
Replace all occurrences of a string within another string in-place. | |
std::string gul17::replace | ( | std::string_view | haystack, |
std::string_view | needle, | ||
std::string_view | hammer | ||
) |
Replace all occurrences of a string within another string, returning the result as a std::string.
Specifically, replace all occurrences of needle within haystack by hammer.
haystack | The string in which search&replace should take place. |
needle | The string to be searched for. If this is an empty string, a copy of haystack is returned. |
hammer | The replacement string. |
References gul17::bit_set().
std::string & gul17::replace_inplace | ( | std::string & | haystack, |
std::string_view | needle, | ||
std::string_view | hammer | ||
) |
Replace all occurrences of a string within another string in-place.
This function replaces all occurrences of needle within haystack by hammer and returns a reference to the modified haystack.
haystack | The string in which search&replace should take place. |
needle | The string to be searched for. If this is an empty string, haystack is not changed. |
hammer | The replacement string. |
References gul17::bit_set().