OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/string_split.h" | 5 #include "base/strings/string_split.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/third_party/icu/icu_utf.h" | 9 #include "base/third_party/icu/icu_utf.h" |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 #if CHAR_MIN < 0 | 223 #if CHAR_MIN < 0 |
224 DCHECK_GE(c, 0); | 224 DCHECK_GE(c, 0); |
225 #endif | 225 #endif |
226 DCHECK_LT(c, 0x7F); | 226 DCHECK_LT(c, 0x7F); |
227 *result = SplitStringT<std::string, std::string, char>( | 227 *result = SplitStringT<std::string, std::string, char>( |
228 str, c, TRIM_WHITESPACE, SPLIT_WANT_ALL); | 228 str, c, TRIM_WHITESPACE, SPLIT_WANT_ALL); |
229 | 229 |
230 // Backward-compat hack, see above. | 230 // Backward-compat hack, see above. |
231 if (result->size() == 1 && (*result)[0].empty()) | 231 if (result->size() == 1 && (*result)[0].empty()) |
232 result->clear(); | 232 result->clear(); |
233 | |
234 } | 233 } |
235 | 234 |
236 bool SplitStringIntoKeyValuePairs(const std::string& line, | 235 bool SplitStringIntoKeyValuePairs(const std::string& line, |
237 char key_value_delimiter, | 236 char key_value_delimiter, |
238 char key_value_pair_delimiter, | 237 char key_value_pair_delimiter, |
239 StringPairs* key_value_pairs) { | 238 StringPairs* key_value_pairs) { |
240 key_value_pairs->clear(); | 239 key_value_pairs->clear(); |
241 | 240 |
242 std::vector<std::string> pairs; | 241 std::vector<std::string> pairs; |
243 SplitString(line, key_value_pair_delimiter, &pairs); | 242 SplitString(line, key_value_pair_delimiter, &pairs); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 298 } |
300 | 299 |
301 void SplitStringAlongWhitespace(const std::string& str, | 300 void SplitStringAlongWhitespace(const std::string& str, |
302 std::vector<std::string>* result) { | 301 std::vector<std::string>* result) { |
303 *result = SplitStringT<std::string, std::string, StringPiece>( | 302 *result = SplitStringT<std::string, std::string, StringPiece>( |
304 str, StringPiece(kWhitespaceASCII), | 303 str, StringPiece(kWhitespaceASCII), |
305 TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); | 304 TRIM_WHITESPACE, SPLIT_WANT_NONEMPTY); |
306 } | 305 } |
307 | 306 |
308 } // namespace base | 307 } // namespace base |
OLD | NEW |