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

Side by Side Diff: base/string_util.h

Issue 244008: Beginnings of our own FTP LIST parsing code. (Closed)
Patch Set: test even more (slightly) Created 11 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
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Searches for CR or LF characters. Removes all contiguous whitespace 167 // Searches for CR or LF characters. Removes all contiguous whitespace
168 // strings that contain them. This is useful when trying to deal with text 168 // strings that contain them. This is useful when trying to deal with text
169 // copied from terminals. 169 // copied from terminals.
170 // Returns |text|, with the following three transformations: 170 // Returns |text|, with the following three transformations:
171 // (1) Leading and trailing whitespace is trimmed. 171 // (1) Leading and trailing whitespace is trimmed.
172 // (2) If |trim_sequences_with_line_breaks| is true, any other whitespace 172 // (2) If |trim_sequences_with_line_breaks| is true, any other whitespace
173 // sequences containing a CR or LF are trimmed. 173 // sequences containing a CR or LF are trimmed.
174 // (3) All other whitespace sequences are converted to single spaces. 174 // (3) All other whitespace sequences are converted to single spaces.
175 std::wstring CollapseWhitespace(const std::wstring& text, 175 std::wstring CollapseWhitespace(const std::wstring& text,
176 bool trim_sequences_with_line_breaks); 176 bool trim_sequences_with_line_breaks);
177 string16 CollapseWhitespace(const string16& text,
178 bool trim_sequences_with_line_breaks);
177 std::string CollapseWhitespaceASCII(const std::string& text, 179 std::string CollapseWhitespaceASCII(const std::string& text,
178 bool trim_sequences_with_line_breaks); 180 bool trim_sequences_with_line_breaks);
179 181
180 // These convert between ASCII (7-bit) and Wide/UTF16 strings. 182 // These convert between ASCII (7-bit) and Wide/UTF16 strings.
181 std::string WideToASCII(const std::wstring& wide); 183 std::string WideToASCII(const std::wstring& wide);
182 std::wstring ASCIIToWide(const base::StringPiece& ascii); 184 std::wstring ASCIIToWide(const base::StringPiece& ascii);
183 std::string UTF16ToASCII(const string16& utf16); 185 std::string UTF16ToASCII(const string16& utf16);
184 string16 ASCIIToUTF16(const base::StringPiece& ascii); 186 string16 ASCIIToUTF16(const base::StringPiece& ascii);
185 187
186 // Converts the given wide string to the corresponding Latin1. This will fail 188 // Converts the given wide string to the corresponding Latin1. This will fail
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 #elif defined(WCHAR_T_IS_UTF32) 607 #elif defined(WCHAR_T_IS_UTF32)
606 typedef uint32 Unsigned; 608 typedef uint32 Unsigned;
607 #endif 609 #endif
608 }; 610 };
609 template<> 611 template<>
610 struct ToUnsigned<short> { 612 struct ToUnsigned<short> {
611 typedef unsigned short Unsigned; 613 typedef unsigned short Unsigned;
612 }; 614 };
613 615
614 #endif // BASE_STRING_UTIL_H_ 616 #endif // BASE_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698