| 2054 | } |
| 2055 | |
| 2056 | void split(const char* str, const char* sep, std::vector<std::string>& out) { |
| 2057 | const char* ptr = str, *start = str; |
| 2058 | while (*ptr) { |
| 2059 | if (strchr(sep, (int) (*ptr)) != NULL) { |
| 2060 | if (start < ptr) { |
| 2061 | size_t n = ptr - start; |
| 2062 | std::string buf; |
| 2063 | buf.assign(start, n); |
| 2064 | out.push_back(buf); |
| 2065 | } |
| 2066 | start = ptr + 1; |
| 2067 | } |
| 2068 | ptr++; |
| 2069 | } |
| 2070 | |
| 2071 | if (*start) { |
| 2072 | std::string buf = start; |
| 2073 | out.push_back(start); |
| 2074 | } |
| 2075 | } |
| 2076 | |
| 2077 | size_t split(const char* str, const char* sep, std::list<std::string>& out) { |
| 2078 | size_t cnt = 0; |