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

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

Issue 22031002: Omnibox: Create DemoteByType Experiment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter + Alexei comments Created 7 years, 4 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 | Annotate | Revision Log
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/third_party/icu/icu_utf.h" 10 #include "base/third_party/icu/icu_utf.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return false; // no value 73 return false; // no value
74 } 74 }
75 std::string values_string(remains, begin_values_pos, 75 std::string values_string(remains, begin_values_pos,
76 remains.size() - begin_values_pos); 76 remains.size() - begin_values_pos);
77 77
78 // Construct the values vector. 78 // Construct the values vector.
79 values->push_back(values_string); 79 values->push_back(values_string);
80 return true; 80 return true;
81 } 81 }
82 82
83 bool SplitStringIntoKeyValuePairs( 83 bool SplitStringIntoKeyValuePairs(const std::string& line,
84 const std::string& line, 84 char key_value_delimiter,
85 char key_value_delimiter, 85 char key_value_pair_delimiter,
86 char key_value_pair_delimiter, 86 KeyValuePairs* kv_pairs) {
87 std::vector<std::pair<std::string, std::string> >* kv_pairs) {
88 kv_pairs->clear(); 87 kv_pairs->clear();
89 88
90 std::vector<std::string> pairs; 89 std::vector<std::string> pairs;
91 SplitString(line, key_value_pair_delimiter, &pairs); 90 SplitString(line, key_value_pair_delimiter, &pairs);
92 91
93 bool success = true; 92 bool success = true;
94 for (size_t i = 0; i < pairs.size(); ++i) { 93 for (size_t i = 0; i < pairs.size(); ++i) {
95 // Empty pair. SplitStringIntoKeyValues is more strict about an empty pair 94 // Empty pair. SplitStringIntoKeyValues is more strict about an empty pair
96 // line, so continue with the next pair. 95 // line, so continue with the next pair.
97 if (pairs[i].empty()) 96 if (pairs[i].empty())
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::vector<string16>* result) { 210 std::vector<string16>* result) {
212 SplitStringAlongWhitespaceT(str, result); 211 SplitStringAlongWhitespaceT(str, result);
213 } 212 }
214 213
215 void SplitStringAlongWhitespace(const std::string& str, 214 void SplitStringAlongWhitespace(const std::string& str,
216 std::vector<std::string>* result) { 215 std::vector<std::string>* result) {
217 SplitStringAlongWhitespaceT(str, result); 216 SplitStringAlongWhitespaceT(str, result);
218 } 217 }
219 218
220 } // namespace base 219 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698