MCPcopy Create free account
hub / github.com/avast/retdec / replaceCharsWithStrings

Function replaceCharsWithStrings

src/utils/string.cpp:652–663  ·  view source on GitHub ↗

* @brief Replaces all occurrences of @a what with @a withWhat in @a str and * returns the resulting string. */

Source from the content-addressed store, hash-verified

650* returns the resulting string.
651*/
652std::string replaceCharsWithStrings(const std::string &str, char what,
653 const std::string &withWhat) {
654 std::string result;
655 for (const auto &c : str) {
656 if (c == what) {
657 result += withWhat;
658 } else {
659 result += c;
660 }
661 }
662 return result;
663}
664
665/**
666* @brief Retruns @c true if @a str ends with the suffix @a withWhat, @c false

Callers 3

commentMethod · 0.85
commentMethod · 0.85
createLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected