OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STRINGS_STRING_UTIL_H_ | 7 #ifndef BASE_STRINGS_STRING_UTIL_H_ |
8 #define BASE_STRINGS_STRING_UTIL_H_ | 8 #define BASE_STRINGS_STRING_UTIL_H_ |
9 | 9 |
10 #include <ctype.h> | 10 #include <ctype.h> |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 TrimPositions positions, | 236 TrimPositions positions, |
237 string16* output); | 237 string16* output); |
238 BASE_EXPORT StringPiece16 TrimWhitespace(StringPiece16 input, | 238 BASE_EXPORT StringPiece16 TrimWhitespace(StringPiece16 input, |
239 TrimPositions positions); | 239 TrimPositions positions); |
240 BASE_EXPORT TrimPositions TrimWhitespaceASCII(const std::string& input, | 240 BASE_EXPORT TrimPositions TrimWhitespaceASCII(const std::string& input, |
241 TrimPositions positions, | 241 TrimPositions positions, |
242 std::string* output); | 242 std::string* output); |
243 BASE_EXPORT StringPiece TrimWhitespaceASCII(StringPiece input, | 243 BASE_EXPORT StringPiece TrimWhitespaceASCII(StringPiece input, |
244 TrimPositions positions); | 244 TrimPositions positions); |
245 | 245 |
246 // Deprecated. This function is only for backward compatibility and calls | |
247 // TrimWhitespaceASCII(). | |
248 BASE_EXPORT TrimPositions TrimWhitespace(const std::string& input, | |
249 TrimPositions positions, | |
250 std::string* output); | |
251 | |
252 // Searches for CR or LF characters. Removes all contiguous whitespace | 246 // Searches for CR or LF characters. Removes all contiguous whitespace |
253 // strings that contain them. This is useful when trying to deal with text | 247 // strings that contain them. This is useful when trying to deal with text |
254 // copied from terminals. | 248 // copied from terminals. |
255 // Returns |text|, with the following three transformations: | 249 // Returns |text|, with the following three transformations: |
256 // (1) Leading and trailing whitespace is trimmed. | 250 // (1) Leading and trailing whitespace is trimmed. |
257 // (2) If |trim_sequences_with_line_breaks| is true, any other whitespace | 251 // (2) If |trim_sequences_with_line_breaks| is true, any other whitespace |
258 // sequences containing a CR or LF are trimmed. | 252 // sequences containing a CR or LF are trimmed. |
259 // (3) All other whitespace sequences are converted to single spaces. | 253 // (3) All other whitespace sequences are converted to single spaces. |
260 BASE_EXPORT string16 CollapseWhitespace( | 254 BASE_EXPORT string16 CollapseWhitespace( |
261 const string16& text, | 255 const string16& text, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 450 |
457 #if defined(OS_WIN) | 451 #if defined(OS_WIN) |
458 #include "base/strings/string_util_win.h" | 452 #include "base/strings/string_util_win.h" |
459 #elif defined(OS_POSIX) | 453 #elif defined(OS_POSIX) |
460 #include "base/strings/string_util_posix.h" | 454 #include "base/strings/string_util_posix.h" |
461 #else | 455 #else |
462 #error Define string operations appropriately for your platform | 456 #error Define string operations appropriately for your platform |
463 #endif | 457 #endif |
464 | 458 |
465 #endif // BASE_STRINGS_STRING_UTIL_H_ | 459 #endif // BASE_STRINGS_STRING_UTIL_H_ |
OLD | NEW |