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

Side by Side Diff: base/string_util.h

Issue 267001: Separate out some more ICU from base and into base/i18n.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « base/i18n/number_formatting.cc ('k') | base/string_util_icu.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file defines utility functions for working with strings. 5 // This file defines utility functions for working with strings.
6 6
7 #ifndef BASE_STRING_UTIL_H_ 7 #ifndef BASE_STRING_UTIL_H_
8 #define BASE_STRING_UTIL_H_ 8 #define BASE_STRING_UTIL_H_
9 9
10 #include <stdarg.h> // va_list 10 #include <stdarg.h> // va_list
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 std::wstring* output); 133 std::wstring* output);
134 bool TrimString(const std::string& input, 134 bool TrimString(const std::string& input,
135 const char trim_chars[], 135 const char trim_chars[],
136 std::string* output); 136 std::string* output);
137 137
138 // Trims any whitespace from either end of the input string. Returns where 138 // Trims any whitespace from either end of the input string. Returns where
139 // whitespace was found. 139 // whitespace was found.
140 // The non-wide version has two functions: 140 // The non-wide version has two functions:
141 // * TrimWhitespaceASCII() 141 // * TrimWhitespaceASCII()
142 // This function is for ASCII strings and only looks for ASCII whitespace; 142 // This function is for ASCII strings and only looks for ASCII whitespace;
143 // * TrimWhitespaceUTF8()
144 // This function is for UTF-8 strings and looks for Unicode whitespace.
145 // Please choose the best one according to your usage. 143 // Please choose the best one according to your usage.
146 // NOTE: Safe to use the same variable for both input and output. 144 // NOTE: Safe to use the same variable for both input and output.
147 enum TrimPositions { 145 enum TrimPositions {
148 TRIM_NONE = 0, 146 TRIM_NONE = 0,
149 TRIM_LEADING = 1 << 0, 147 TRIM_LEADING = 1 << 0,
150 TRIM_TRAILING = 1 << 1, 148 TRIM_TRAILING = 1 << 1,
151 TRIM_ALL = TRIM_LEADING | TRIM_TRAILING, 149 TRIM_ALL = TRIM_LEADING | TRIM_TRAILING,
152 }; 150 };
153 TrimPositions TrimWhitespace(const std::wstring& input, 151 TrimPositions TrimWhitespace(const std::wstring& input,
154 TrimPositions positions, 152 TrimPositions positions,
155 std::wstring* output); 153 std::wstring* output);
156 TrimPositions TrimWhitespaceASCII(const std::string& input, 154 TrimPositions TrimWhitespaceASCII(const std::string& input,
157 TrimPositions positions, 155 TrimPositions positions,
158 std::string* output); 156 std::string* output);
159 TrimPositions TrimWhitespaceUTF8(const std::string& input,
160 TrimPositions positions,
161 std::string* output);
162 157
163 // Deprecated. This function is only for backward compatibility and calls 158 // Deprecated. This function is only for backward compatibility and calls
164 // TrimWhitespaceASCII(). 159 // TrimWhitespaceASCII().
165 TrimPositions TrimWhitespace(const std::string& input, 160 TrimPositions TrimWhitespace(const std::string& input,
166 TrimPositions positions, 161 TrimPositions positions,
167 std::string* output); 162 std::string* output);
168 163
169 // Searches for CR or LF characters. Removes all contiguous whitespace 164 // Searches for CR or LF characters. Removes all contiguous whitespace
170 // strings that contain them. This is useful when trying to deal with text 165 // strings that contain them. This is useful when trying to deal with text
171 // copied from terminals. 166 // copied from terminals.
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 #elif defined(WCHAR_T_IS_UTF32) 576 #elif defined(WCHAR_T_IS_UTF32)
582 typedef uint32 Unsigned; 577 typedef uint32 Unsigned;
583 #endif 578 #endif
584 }; 579 };
585 template<> 580 template<>
586 struct ToUnsigned<short> { 581 struct ToUnsigned<short> {
587 typedef unsigned short Unsigned; 582 typedef unsigned short Unsigned;
588 }; 583 };
589 584
590 #endif // BASE_STRING_UTIL_H_ 585 #endif // BASE_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « base/i18n/number_formatting.cc ('k') | base/string_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698