4 * Created on: Jul 21, 2009
18 * Split string s according to given delimiters. Mostly borrowed
19 * from C++ Programming HOWTO 7.3.
21 static inline void tokenize(const string& s,
26 string::size_type lastPos = s.find_first_not_of(delims, 0);
27 string::size_type pos = s.find_first_of(delims, lastPos);
28 while (string::npos != pos || string::npos != lastPos) {
29 ss.push_back(s.substr(lastPos, pos - lastPos));
30 lastPos = s.find_first_not_of(delims, pos);
31 pos = s.find_first_of(delims, lastPos);
32 if(ss.size() == (max - 1)) {
38 static inline void tokenize(
41 std::vector<std::string>& ss)
44 std::istringstream iss(s);
45 while(getline(iss, token, delim)) {
50 #endif /*TOKENIZE_H_*/