| 182 | } |
| 183 | |
| 184 | void split(const rdcstr &in, rdcarray<rdcstr> &out, const char sep) |
| 185 | { |
| 186 | if(in.empty()) |
| 187 | return; |
| 188 | |
| 189 | { |
| 190 | size_t numSeps = 0; |
| 191 | |
| 192 | int offset = in.find(sep); |
| 193 | while(offset >= 0) |
| 194 | { |
| 195 | numSeps++; |
| 196 | offset = in.find(sep, offset + 1); |
| 197 | } |
| 198 | |
| 199 | out.reserve(numSeps + 1); |
| 200 | out.clear(); |
| 201 | } |
| 202 | |
| 203 | int32_t begin = 0; |
| 204 | int32_t end = in.find(sep); |
| 205 | |
| 206 | while(end >= 0) |
| 207 | { |
| 208 | out.push_back(in.substr(begin, end - begin)); |
| 209 | |
| 210 | begin = end + 1; |
| 211 | end = in.find(sep, begin); |
| 212 | } |
| 213 | |
| 214 | if(begin < in.count() || (begin == in.count() && in.back() == sep)) |
| 215 | out.push_back(in.substr(begin)); |
| 216 | } |
| 217 | |
| 218 | void merge(const rdcarray<rdcstr> &in, rdcstr &out, const char sep) |
| 219 | { |
no test coverage detected