|
a |
|
b/src/Common/Utils.h |
|
|
1 |
/*
|
|
|
2 |
* Utils.h
|
|
|
3 |
*
|
|
|
4 |
* Created on: Mar 5, 2015
|
|
|
5 |
* Author: gaixas1
|
|
|
6 |
*/
|
|
|
7 |
|
|
|
8 |
#ifndef UTILS_H_
|
|
|
9 |
#define UTILS_H_
|
|
|
10 |
|
|
|
11 |
#include <string>
|
|
|
12 |
#include <sstream>
|
|
|
13 |
#include <vector>
|
|
|
14 |
|
|
|
15 |
/*
|
|
|
16 |
* Explode a string into a vector of strings, given a delimiter
|
|
|
17 |
*
|
|
|
18 |
*/
|
|
|
19 |
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
|
|
20 |
std::vector<std::string> split(const std::string &s, char delim);
|
|
|
21 |
|
|
|
22 |
/*
|
|
|
23 |
* Implode the first n values of a vector of string into a strings, separated by a delimiter
|
|
|
24 |
*
|
|
|
25 |
*/
|
|
|
26 |
std::string join(const std::vector<std::string> &elems, const unsigned int n, const char delim);
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
/*
|
|
|
30 |
* Check if the first value is a prefix of the second
|
|
|
31 |
*
|
|
|
32 |
*/
|
|
|
33 |
bool isPrefix(std::string prefix, std::string s);
|
|
|
34 |
|
|
|
35 |
#endif /* UTILS_H_ */
|