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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 CompareCase case_sensitivity); | 330 CompareCase case_sensitivity); |
331 | 331 |
332 // Determines the type of ASCII character, independent of locale (the C | 332 // Determines the type of ASCII character, independent of locale (the C |
333 // library versions will change based on locale). | 333 // library versions will change based on locale). |
334 template <typename Char> | 334 template <typename Char> |
335 inline bool IsAsciiWhitespace(Char c) { | 335 inline bool IsAsciiWhitespace(Char c) { |
336 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; | 336 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; |
337 } | 337 } |
338 template <typename Char> | 338 template <typename Char> |
339 inline bool IsAsciiAlpha(Char c) { | 339 inline bool IsAsciiAlpha(Char c) { |
340 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); | 340 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); |
| 341 } |
| 342 template <typename Char> |
| 343 inline bool IsAsciiUpper(Char c) { |
| 344 return c >= 'A' && c <= 'Z'; |
| 345 } |
| 346 template <typename Char> |
| 347 inline bool IsAsciiLower(Char c) { |
| 348 return c >= 'a' && c <= 'z'; |
341 } | 349 } |
342 template <typename Char> | 350 template <typename Char> |
343 inline bool IsAsciiDigit(Char c) { | 351 inline bool IsAsciiDigit(Char c) { |
344 return c >= '0' && c <= '9'; | 352 return c >= '0' && c <= '9'; |
345 } | 353 } |
346 | 354 |
347 template <typename Char> | 355 template <typename Char> |
348 inline bool IsHexDigit(Char c) { | 356 inline bool IsHexDigit(Char c) { |
349 return (c >= '0' && c <= '9') || | 357 return (c >= '0' && c <= '9') || |
350 (c >= 'A' && c <= 'F') || | 358 (c >= 'A' && c <= 'F') || |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 460 |
453 #if defined(OS_WIN) | 461 #if defined(OS_WIN) |
454 #include "base/strings/string_util_win.h" | 462 #include "base/strings/string_util_win.h" |
455 #elif defined(OS_POSIX) | 463 #elif defined(OS_POSIX) |
456 #include "base/strings/string_util_posix.h" | 464 #include "base/strings/string_util_posix.h" |
457 #else | 465 #else |
458 #error Define string operations appropriately for your platform | 466 #error Define string operations appropriately for your platform |
459 #endif | 467 #endif |
460 | 468 |
461 #endif // BASE_STRINGS_STRING_UTIL_H_ | 469 #endif // BASE_STRINGS_STRING_UTIL_H_ |
OLD | NEW |