-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.cpp
More file actions
42 lines (36 loc) · 791 Bytes
/
utils.cpp
File metadata and controls
42 lines (36 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "Server.hpp"
using std::string;
using std::vector;
using std::map;
bool contains(string &haystack, string const &needles)
{
for (u_int32_t i = 0; i < needles.length(); i++)
{
if (haystack.find(needles[i]) != string::npos)
return (true);
}
return (false);
}
void printsvec(std::vector<std::string> strs)
{
std::cout << "[ ";
for (u_int32_t i = 0; i < strs.size(); i++)
{
std::cout << strs[i] << " ";
}
std::cout << "]" << std::endl;
}
vector<string> split(string str, char delim)
{
vector<string> strVec;
string u;
std::istringstream sstream(str);
while (getline(sstream, u, delim))
strVec.push_back(u);
return (strVec);
}
void to_upper(std::string& str)
{
for (std::string::iterator p = str.begin(); str.end() != p; ++p)
*p = toupper(*p);
}