| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Returns the integer corresponding to the given hex character. For example: | 353 // Returns the integer corresponding to the given hex character. For example: |
| 354 // '4' -> 4 | 354 // '4' -> 4 |
| 355 // 'a' -> 10 | 355 // 'a' -> 10 |
| 356 // 'B' -> 11 | 356 // 'B' -> 11 |
| 357 // Assumes the input is a valid hex character. DCHECKs in debug builds if not. | 357 // Assumes the input is a valid hex character. DCHECKs in debug builds if not. |
| 358 BASE_EXPORT char HexDigitToInt(wchar_t c); | 358 BASE_EXPORT char HexDigitToInt(wchar_t c); |
| 359 | 359 |
| 360 // Returns true if it's a Unicode whitespace character. | 360 // Returns true if it's a Unicode whitespace character. |
| 361 inline bool IsUnicodeWhitespace(wchar_t c) { | 361 BASE_EXPORT bool IsUnicodeWhitespace(wchar_t c); |
| 362 return wcschr(base::kWhitespaceWide, c) != NULL; | |
| 363 } | |
| 364 | 362 |
| 365 // Return a byte string in human-readable format with a unit suffix. Not | 363 // Return a byte string in human-readable format with a unit suffix. Not |
| 366 // appropriate for use in any UI; use of FormatBytes and friends in ui/base is | 364 // appropriate for use in any UI; use of FormatBytes and friends in ui/base is |
| 367 // highly recommended instead. TODO(avi): Figure out how to get callers to use | 365 // highly recommended instead. TODO(avi): Figure out how to get callers to use |
| 368 // FormatBytes instead; remove this. | 366 // FormatBytes instead; remove this. |
| 369 BASE_EXPORT string16 FormatBytesUnlocalized(int64 bytes); | 367 BASE_EXPORT string16 FormatBytesUnlocalized(int64 bytes); |
| 370 | 368 |
| 371 // Starting at |start_offset| (usually 0), replace the first instance of | 369 // Starting at |start_offset| (usually 0), replace the first instance of |
| 372 // |find_this| with |replace_with|. | 370 // |find_this| with |replace_with|. |
| 373 BASE_EXPORT void ReplaceFirstSubstringAfterOffset( | 371 BASE_EXPORT void ReplaceFirstSubstringAfterOffset( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 451 |
| 454 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
| 455 #include "base/strings/string_util_win.h" | 453 #include "base/strings/string_util_win.h" |
| 456 #elif defined(OS_POSIX) | 454 #elif defined(OS_POSIX) |
| 457 #include "base/strings/string_util_posix.h" | 455 #include "base/strings/string_util_posix.h" |
| 458 #else | 456 #else |
| 459 #error Define string operations appropriately for your platform | 457 #error Define string operations appropriately for your platform |
| 460 #endif | 458 #endif |
| 461 | 459 |
| 462 #endif // BASE_STRINGS_STRING_UTIL_H_ | 460 #endif // BASE_STRINGS_STRING_UTIL_H_ |
| OLD | NEW |