Function liberate::string::replace

Function Documentation

std::string liberate::string::replace(std::string const &haystack, std::string const &needle, std::string const &substitute, bool first_only = false)

Replace needle in haystack with substitute.

Parameters
  • haystack[in] The haystack to replace occurrences in.

  • needle[in] The string to find in the haystack.

  • substitute[in] The string to substitute for the found needle.

  • first_only[in] If set, replace only the first occurrence of the needle with the substitute. Defaults to false.

Returns

The haystack with occurrences of needle replaced by substitute.