| OLD | NEW |
| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 bool EqualsASCII(const string16& a, const StringPiece& b); | 356 bool EqualsASCII(const string16& a, const StringPiece& b); |
| 357 | 357 |
| 358 // Returns true if str starts with search, or false otherwise. | 358 // Returns true if str starts with search, or false otherwise. |
| 359 bool StartsWithASCII(const std::string& str, | 359 bool StartsWithASCII(const std::string& str, |
| 360 const std::string& search, | 360 const std::string& search, |
| 361 bool case_sensitive); | 361 bool case_sensitive); |
| 362 bool StartsWith(const std::wstring& str, | 362 bool StartsWith(const std::wstring& str, |
| 363 const std::wstring& search, | 363 const std::wstring& search, |
| 364 bool case_sensitive); | 364 bool case_sensitive); |
| 365 | 365 |
| 366 // Returns true if str ends with search, or false otherwise. |
| 367 bool EndsWith(const std::wstring& str, |
| 368 const std::wstring& search, |
| 369 bool case_sensitive); |
| 370 |
| 371 |
| 366 // Determines the type of ASCII character, independent of locale (the C | 372 // Determines the type of ASCII character, independent of locale (the C |
| 367 // library versions will change based on locale). | 373 // library versions will change based on locale). |
| 368 template <typename Char> | 374 template <typename Char> |
| 369 inline bool IsAsciiWhitespace(Char c) { | 375 inline bool IsAsciiWhitespace(Char c) { |
| 370 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; | 376 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; |
| 371 } | 377 } |
| 372 template <typename Char> | 378 template <typename Char> |
| 373 inline bool IsAsciiAlpha(Char c) { | 379 inline bool IsAsciiAlpha(Char c) { |
| 374 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); | 380 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); |
| 375 } | 381 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 #elif defined(WCHAR_T_IS_UTF32) | 660 #elif defined(WCHAR_T_IS_UTF32) |
| 655 typedef uint32 Unsigned; | 661 typedef uint32 Unsigned; |
| 656 #endif | 662 #endif |
| 657 }; | 663 }; |
| 658 template<> | 664 template<> |
| 659 struct ToUnsigned<short> { | 665 struct ToUnsigned<short> { |
| 660 typedef unsigned short Unsigned; | 666 typedef unsigned short Unsigned; |
| 661 }; | 667 }; |
| 662 | 668 |
| 663 #endif // BASE_STRING_UTIL_H_ | 669 #endif // BASE_STRING_UTIL_H_ |
| OLD | NEW |