Commit cf1400f7 authored by Sebastian Wolf's avatar Sebastian Wolf

Added contains for strings

parent 8dd67869
......@@ -36,6 +36,9 @@ namespace xerus {
///@brief: Explodes a string at positions indicated by _delim.
std::vector<std::string> explode(const std::string& _string, const char _delim);
///@brief: Returns true if _string contains _search as a substring.
bool contains(const std::string& _string, const std::string& _search);
///@brief: Replaces all occurences of _search in _string by _replace.
void replace(std::string& _string, const std::string& _search, const std::string& _replace);
......
......@@ -62,6 +62,10 @@ namespace xerus {
return result;
}
bool contains(const std::string& _string, const std::string& _search) {
return _string.find(_search) != std::string::npos;
}
void replace(std::string& _string, const std::string& _search, const std::string& _replace) {
size_t pos = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment