Template Function rcpputils::find_and_replace(const std::basic_string<CharT, Traits, Allocator>&, const std::basic_string<CharT, Traits, Allocator>&, const std::basic_string<CharT, Traits, Allocator>&)

Function Documentation

template<class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT>>
std::basic_string<CharT, Traits, Allocator> rcpputils::find_and_replace(const std::basic_string<CharT, Traits, Allocator> &input, const std::basic_string<CharT, Traits, Allocator> &find, const std::basic_string<CharT, Traits, Allocator> &replace)

Find and replace all instances of a string with another string.

Parameters:
  • input[in] The input string.

  • find[in] The substring to replace.

  • replace[in] The string to substitute for each occurrence of find.

Returns:

A copy of the input string with all instances of the string find replaced with the string replace.