0
|
1 #ifndef __SPLIT_H
|
|
2 #define __SPLIT_H
|
|
3
|
|
4 // functions to split a string by a specific delimiter
|
|
5 #include <string>
|
|
6 #include <vector>
|
|
7 #include <sstream>
|
|
8 #include <string.h>
|
|
9
|
|
10 // thanks to Evan Teran, http://stackoverflow.com/questions/236129/how-to-split-a-string/236803#236803
|
|
11
|
|
12 // split a string on a single delimiter character (delim)
|
|
13 std::vector<std::string>& split(const std::string &s, char delim, std::vector<std::string> &elems);
|
|
14 std::vector<std::string> split(const std::string &s, char delim);
|
|
15
|
|
16 // split a string on any character found in the string of delimiters (delims)
|
|
17 std::vector<std::string>& split(const std::string &s, const std::string& delims, std::vector<std::string> &elems);
|
|
18 std::vector<std::string> split(const std::string &s, const std::string& delims);
|
|
19
|
|
20 #endif
|