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

Function removeSuffixRet

src/utils/string.cpp:1128–1135  ·  view source on GitHub ↗

* @brief Finds the last occurrence of the specified suffix and removes * everything from its start to the end. * @param[in] n Source string. * @param[in] suffix Suffix to find and remove. * * @return Copy of source string without suffix address. */

Source from the content-addressed store, hash-verified

1126* @return Copy of source string without suffix address.
1127*/
1128std::string removeSuffixRet(const std::string &n, const std::string &suffix) {
1129 std::string ret = n;
1130 std::size_t found = ret.rfind(suffix);
1131 if (found != std::string::npos) {
1132 ret = ret.substr(0, found);
1133 }
1134 return ret;
1135}
1136
1137/**
1138* @brief Replaces all special symbols by their normalized equivalent.

Callers 1

TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.68