Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: base/strings/string_split.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/strings/string_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/strings/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698