OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef BASE_STRING_SPLIT_H_ | 5 #ifndef BASE_STRING_SPLIT_H_ |
6 #define BASE_STRING_SPLIT_H_ | 6 #define BASE_STRING_SPLIT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/string16.h" |
| 14 |
13 namespace base { | 15 namespace base { |
14 | 16 |
15 bool SplitStringIntoKeyValues( | 17 bool SplitStringIntoKeyValues( |
16 const std::string& line, | 18 const std::string& line, |
17 char key_value_delimiter, | 19 char key_value_delimiter, |
18 std::string* key, std::vector<std::string>* values); | 20 std::string* key, std::vector<std::string>* values); |
19 | 21 |
20 bool SplitStringIntoKeyValuePairs( | 22 bool SplitStringIntoKeyValuePairs( |
21 const std::string& line, | 23 const std::string& line, |
22 char key_value_delimiter, | 24 char key_value_delimiter, |
23 char key_value_pair_delimiter, | 25 char key_value_pair_delimiter, |
24 std::vector<std::pair<std::string, std::string> >* kv_pairs); | 26 std::vector<std::pair<std::string, std::string> >* kv_pairs); |
25 | 27 |
| 28 // The same as SplitString, but use a substring delimiter instead of a char. |
| 29 void SplitStringUsingSubstr(const string16& str, |
| 30 const string16& s, |
| 31 std::vector<string16>* r); |
| 32 void SplitStringUsingSubstr(const std::string& str, |
| 33 const std::string& s, |
| 34 std::vector<std::string>* r); |
| 35 |
26 } // namespace base | 36 } // namespace base |
27 | 37 |
28 #endif // BASE_STRING_SPLIT_H | 38 #endif // BASE_STRING_SPLIT_H |
OLD | NEW |