-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUtils.h
39 lines (28 loc) · 766 Bytes
/
Utils.h
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
//
// Created by Stas Piter on 25.02.2021.
//
#ifndef FASTCGI_BLOG_UTILS_H
#define FASTCGI_BLOG_UTILS_H
#include <string>
#include <vector>
#include <iomanip>
class Utils {
public:
static std::vector<std::string> Split(const std::string& s, char delim) {
std::vector<std::string> result;
std::stringstream ss(s);
std::string item;
while (getline(ss, item, delim))
result.push_back(item);
return result;
}
static std::vector<std::string> Tokenize(const std::string& str) {
std::vector<std::string> v;
std::istringstream iss(str);
std::string s;
while (iss >> std::quoted(s))
v.push_back(s);
return v;
}
};
#endif //FASTCGI_BLOG_UTILS_H