Split `*orig` into two pieces at the first occurrence of `split_ch`. Returns whether `split_ch` was found. Afterwards, `*before_split` contains the maximum prefix of the input `*orig` that doesn't contain `split_ch`, and `*orig` contains everything after the first `split_ch`.
| 84 | // contain `split_ch`, and `*orig` contains everything after the |
| 85 | // first `split_ch`. |
| 86 | static bool SplitAt(char split_ch, StringPiece* orig, |
| 87 | StringPiece* before_split) { |
| 88 | auto pos = orig->find(split_ch); |
| 89 | if (pos == StringPiece::npos) { |
| 90 | *before_split = *orig; |
| 91 | *orig = StringPiece(); |
| 92 | return false; |
| 93 | } else { |
| 94 | *before_split = orig->substr(0, pos); |
| 95 | orig->remove_prefix(pos + 1); |
| 96 | return true; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // Does this line start with "<spaces><field>:" where "<field>" is |
| 101 | // in multi_line_fields? Sets *colon_pos to the position of the colon. |
no test coverage detected