This commit is contained in:
Erik Frojdh
2021-09-14 15:14:08 +02:00
parent abf56ad643
commit adaf56ca2e
7 changed files with 188 additions and 121 deletions

View File

@ -36,4 +36,14 @@ bool is_int(const std::string &s) {
}) == s.end();
}
bool replace_first(std::string *s, const std::string& substr, const std::string& repl){
auto pos = s->find(substr);
if (pos != std::string::npos){
s->replace(pos, substr.size(), repl);
return true;
}
return false;
}
}; // namespace sls