| 45 | } |
| 46 | |
| 47 | unsigned int split(char* str_ori, char delim, char* elems[]) |
| 48 | { |
| 49 | const char* str = str_ori; |
| 50 | unsigned int last_jj = 0; |
| 51 | unsigned int jj = 0; |
| 52 | unsigned int elem_cnt = 0; |
| 53 | char c; |
| 54 | for (; c = *str++; ++jj) { |
| 55 | if (c == delim) { |
| 56 | str_ori[jj] = 0; |
| 57 | elems[elem_cnt++] = &str_ori[last_jj]; |
| 58 | last_jj = jj+1; |
| 59 | } |
| 60 | } |
| 61 | elems[elem_cnt++] = &str_ori[last_jj]; |
| 62 | return elem_cnt; |
| 63 | } |
| 64 | |
| 65 | std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { |
| 66 | std::stringstream ss(s); |
no outgoing calls
no test coverage detected