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> |
(...skipping 15 matching lines...) Expand all Loading... |
26 std::vector<std::pair<std::string, std::string> >* kv_pairs); | 26 std::vector<std::pair<std::string, std::string> >* kv_pairs); |
27 | 27 |
28 // The same as SplitString, but use a substring delimiter instead of a char. | 28 // The same as SplitString, but use a substring delimiter instead of a char. |
29 void SplitStringUsingSubstr(const string16& str, | 29 void SplitStringUsingSubstr(const string16& str, |
30 const string16& s, | 30 const string16& s, |
31 std::vector<string16>* r); | 31 std::vector<string16>* r); |
32 void SplitStringUsingSubstr(const std::string& str, | 32 void SplitStringUsingSubstr(const std::string& str, |
33 const std::string& s, | 33 const std::string& s, |
34 std::vector<std::string>* r); | 34 std::vector<std::string>* r); |
35 | 35 |
| 36 // The same as SplitString, but don't trim white space. |
| 37 // Where wchar_t is char16 (i.e. Windows), |c| must be in BMP |
| 38 // (Basic Multilingual Plane). Elsewhere (Linux/Mac), wchar_t |
| 39 // should be a valid Unicode code point (32-bit). |
| 40 void SplitStringDontTrim(const std::wstring& str, |
| 41 wchar_t c, |
| 42 std::vector<std::wstring>* r); |
| 43 // NOTE: |c| must be in BMP (Basic Multilingual Plane) |
| 44 void SplitStringDontTrim(const string16& str, |
| 45 char16 c, |
| 46 std::vector<string16>* r); |
| 47 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which |
| 48 // the trailing byte of a multi-byte character can be in the ASCII range. |
| 49 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK. |
| 50 // Note: |c| must be in the ASCII range. |
| 51 void SplitStringDontTrim(const std::string& str, |
| 52 char c, |
| 53 std::vector<std::string>* r); |
| 54 |
36 } // namespace base | 55 } // namespace base |
37 | 56 |
38 #endif // BASE_STRING_SPLIT_H | 57 #endif // BASE_STRING_SPLIT_H |
OLD | NEW |