| 206 | } |
| 207 | |
| 208 | bool SplitStringIntoKeyValuePairs(StringPiece input, |
| 209 | char key_value_delimiter, |
| 210 | char key_value_pair_delimiter, |
| 211 | StringPairs* key_value_pairs) { |
| 212 | key_value_pairs->clear(); |
| 213 | |
| 214 | std::vector<StringPiece> pairs = SplitStringPiece( |
| 215 | input, std::string(1, key_value_pair_delimiter), |
| 216 | TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); |
| 217 | key_value_pairs->reserve(pairs.size()); |
| 218 | |
| 219 | bool success = true; |
| 220 | for (const StringPiece& pair : pairs) { |
| 221 | if (!AppendStringKeyValue(pair, key_value_delimiter, key_value_pairs)) { |
| 222 | // Don't return here, to allow for pairs without associated |
| 223 | // value or key; just record that the split failed. |
| 224 | success = false; |
| 225 | } |
| 226 | } |
| 227 | return success; |
| 228 | } |
| 229 | |
| 230 | void SplitStringUsingSubstr(StringPiece16 input, |
| 231 | StringPiece16 delimiter, |
no test coverage detected