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

Side by Side Diff: base/string_split.h

Issue 6930047: wstring: remove wstring version of SplitString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 7 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
« no previous file with comments | « no previous file | base/string_split.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base_api.h" 13 #include "base/base_api.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 15
16 namespace base { 16 namespace base {
17 17
18 // Splits |str| into a vector of strings delimited by |s|. Append the results 18 // Splits |str| into a vector of strings delimited by |s|. Append the results
19 // into |r| as they appear. If several instances of |s| are contiguous, or if 19 // into |r| as they appear. If several instances of |s| are contiguous, or if
20 // |str| begins with or ends with |s|, then an empty string is inserted. 20 // |str| begins with or ends with |s|, then an empty string is inserted.
21 // 21 //
22 // Every substring is trimmed of any leading or trailing white space. 22 // Every substring is trimmed of any leading or trailing white space.
23 // Where wchar_t is char16 (i.e. Windows), |c| must be in BMP
24 // (Basic Multilingual Plane). Elsewhere (Linux/Mac), wchar_t
25 // should be a valid Unicode code point (32-bit).
26 BASE_API void SplitString(const std::wstring& str,
27 wchar_t c,
28 std::vector<std::wstring>* r);
29 // NOTE: |c| must be in BMP (Basic Multilingual Plane) 23 // NOTE: |c| must be in BMP (Basic Multilingual Plane)
30 BASE_API void SplitString(const string16& str, 24 BASE_API void SplitString(const string16& str,
31 char16 c, 25 char16 c,
32 std::vector<string16>* r); 26 std::vector<string16>* r);
33 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which 27 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which
34 // the trailing byte of a multi-byte character can be in the ASCII range. 28 // the trailing byte of a multi-byte character can be in the ASCII range.
35 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK. 29 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK.
36 // Note: |c| must be in the ASCII range. 30 // Note: |c| must be in the ASCII range.
37 BASE_API void SplitString(const std::string& str, 31 BASE_API void SplitString(const std::string& str,
38 char c, 32 char c,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 BASE_API void SplitStringAlongWhitespace(const std::wstring& str, 75 BASE_API void SplitStringAlongWhitespace(const std::wstring& str,
82 std::vector<std::wstring>* result); 76 std::vector<std::wstring>* result);
83 BASE_API void SplitStringAlongWhitespace(const string16& str, 77 BASE_API void SplitStringAlongWhitespace(const string16& str,
84 std::vector<string16>* result); 78 std::vector<string16>* result);
85 BASE_API void SplitStringAlongWhitespace(const std::string& str, 79 BASE_API void SplitStringAlongWhitespace(const std::string& str,
86 std::vector<std::string>* result); 80 std::vector<std::string>* result);
87 81
88 } // namespace base 82 } // namespace base
89 83
90 #endif // BASE_STRING_SPLIT_H 84 #endif // BASE_STRING_SPLIT_H
OLDNEW
« no previous file with comments | « no previous file | base/string_split.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698