| 18 | } |
| 19 | |
| 20 | void Split(ConstStringRef str, char split_char, std::vector<ConstStringRef> * pieces) |
| 21 | { |
| 22 | ConstStringRef cur = str; |
| 23 | |
| 24 | for (const char * p = str.Begin; p < str.End; ++p) |
| 25 | { |
| 26 | if (*p == split_char) |
| 27 | { |
| 28 | cur.End = p; |
| 29 | pieces->push_back(cur); |
| 30 | cur.Begin = p+1; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | cur.End = str.End; |
| 35 | if (cur.Begin <= cur.End) |
| 36 | { |
| 37 | pieces->push_back(cur); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | void SplitAt(ConstStringRef str, char split_char, ConstStringRef * left, ConstStringRef * right) |
| 42 | { |