Added basic inline command parser

This commit is contained in:
Bartek Kryza
2021-07-28 23:10:46 +02:00
parent e7f9674433
commit 4cdd034017
7 changed files with 376 additions and 0 deletions

View File

@@ -126,5 +126,20 @@ bool find_element_alias(
return true;
}
bool replace_all(
std::string &input, std::string pattern, std::string replace_with)
{
bool replaced{false};
auto pos = input.find(pattern);
while (pos < input.size()) {
input.replace(pos, pattern.size(), replace_with);
pos = input.find(pattern, pos + replace_with.size());
replaced = true;
}
return replaced;
}
}
}