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

Side by Side Diff: base/string_split.h

Issue 5004002: base: Move StringSplitAlongWhitespace to string_split.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittests Created 10 years, 1 month 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) 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 char16 c, 62 char16 c,
63 std::vector<string16>* r); 63 std::vector<string16>* r);
64 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which 64 // |str| should not be in a multi-byte encoding like Shift-JIS or GBK in which
65 // the trailing byte of a multi-byte character can be in the ASCII range. 65 // the trailing byte of a multi-byte character can be in the ASCII range.
66 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK. 66 // UTF-8, and other single/multi-byte ASCII-compatible encodings are OK.
67 // Note: |c| must be in the ASCII range. 67 // Note: |c| must be in the ASCII range.
68 void SplitStringDontTrim(const std::string& str, 68 void SplitStringDontTrim(const std::string& str,
69 char c, 69 char c,
70 std::vector<std::string>* r); 70 std::vector<std::string>* r);
71 71
72 // WARNING: this uses whitespace as defined by the HTML5 spec. If you need
73 // a function similar to this but want to trim all types of whitespace, then
74 // factor this out into a function that takes a string containing the characters
75 // that are treated as whitespace.
76 //
77 // Splits the string along whitespace (where whitespace is the five space
78 // characters defined by HTML 5). Each contiguous block of non-whitespace
79 // characters is added to result.
80 void SplitStringAlongWhitespace(const std::wstring& str,
81 std::vector<std::wstring>* result);
82 void SplitStringAlongWhitespace(const string16& str,
83 std::vector<string16>* result);
84 void SplitStringAlongWhitespace(const std::string& str,
85 std::vector<std::string>* result);
86
72 } // namespace base 87 } // namespace base
73 88
74 #endif // BASE_STRING_SPLIT_H 89 #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