Euphoria
findstring.cc
Go to the documentation of this file.
1 #include "core/findstring.h"
2 
3 #include <algorithm>
4 
5 namespace eu::core
6 {
7  bool
8  find(const std::string& target, const std::string& search)
9  {
10  return target.find(search) != std::string::npos;
11  }
12 
13 
14  bool
15  find(const std::string& target, const std::vector<std::string>& searches)
16  {
17  return std::all_of
18  (
19  searches.begin(),
20  searches.end(),
21  [&target](const auto& search)
22  {
23  return find(target, search);
24  }
25  );
26  }
27 
28 
29  bool
30  find(const std::vector<std::string>& targets, const std::string& search)
31  {
32  return std::any_of
33  (
34  targets.begin(),
35  targets.end(),
36  [&search](const auto& target)
37  {
38  return find(target, search);
39  }
40  );
41  }
42 
43 
44  bool
45  find(const std::vector<std::string>& targets,
46  const std::vector<std::string>& searches)
47  {
48  return std::any_of
49  (
50  targets.begin(),
51  targets.end(),
52  [&searches](const auto& target)
53  {
54  return find(target, searches);
55  }
56  );
57  }
58 
59 }
bool find(const std::string &target, const std::string &search)
Definition: findstring.cc:8