Implement misc::string_matches
This commit is contained in:
@@ -6,5 +6,5 @@
|
||||
|
||||
namespace misc {
|
||||
std::vector<std::string> string_expand(const std::string& input, char delimiter = ' ');
|
||||
|
||||
bool string_matches(const std::string& x, const std::vector<std::string>& v);
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
#include <misc.hpp>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
std::vector<std::string> misc::string_expand(const std::string& input, char delimiter)
|
||||
{
|
||||
@@ -12,4 +14,10 @@ std::vector<std::string> misc::string_expand(const std::string& input, char deli
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
auto misc::string_matches(const std::string &x, const std::vector<std::string> &v) -> bool {
|
||||
|
||||
return std::find(v.begin(), v.end(), x) != v.end();
|
||||
|
||||
}
|
Reference in New Issue
Block a user