| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 const char* a_end, | 304 const char* a_end, |
| 305 const char* b); | 305 const char* b); |
| 306 BASE_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, | 306 BASE_EXPORT bool LowerCaseEqualsASCII(const char* a_begin, |
| 307 const char* a_end, | 307 const char* a_end, |
| 308 const char* b_begin, | 308 const char* b_begin, |
| 309 const char* b_end); | 309 const char* b_end); |
| 310 BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, | 310 BASE_EXPORT bool LowerCaseEqualsASCII(const char16* a_begin, |
| 311 const char16* a_end, | 311 const char16* a_end, |
| 312 const char* b); | 312 const char* b); |
| 313 | 313 |
| 314 // Performs a case-sensitive string compare. The behavior is undefined if both |
| 315 // strings are not ASCII. |
| 316 BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); |
| 317 |
| 314 } // namespace base | 318 } // namespace base |
| 315 | 319 |
| 316 #if defined(OS_WIN) | 320 #if defined(OS_WIN) |
| 317 #include "base/strings/string_util_win.h" | 321 #include "base/strings/string_util_win.h" |
| 318 #elif defined(OS_POSIX) | 322 #elif defined(OS_POSIX) |
| 319 #include "base/strings/string_util_posix.h" | 323 #include "base/strings/string_util_posix.h" |
| 320 #else | 324 #else |
| 321 #error Define string operations appropriately for your platform | 325 #error Define string operations appropriately for your platform |
| 322 #endif | 326 #endif |
| 323 | 327 |
| 324 // Performs a case-sensitive string compare. The behavior is undefined if both | |
| 325 // strings are not ASCII. | |
| 326 BASE_EXPORT bool EqualsASCII(const base::string16& a, const base::StringPiece& b
); | |
| 327 | |
| 328 // Returns true if str starts with search, or false otherwise. | 328 // Returns true if str starts with search, or false otherwise. |
| 329 BASE_EXPORT bool StartsWithASCII(const std::string& str, | 329 BASE_EXPORT bool StartsWithASCII(const std::string& str, |
| 330 const std::string& search, | 330 const std::string& search, |
| 331 bool case_sensitive); | 331 bool case_sensitive); |
| 332 BASE_EXPORT bool StartsWith(const base::string16& str, | 332 BASE_EXPORT bool StartsWith(const base::string16& str, |
| 333 const base::string16& search, | 333 const base::string16& search, |
| 334 bool case_sensitive); | 334 bool case_sensitive); |
| 335 | 335 |
| 336 // Returns true if str ends with search, or false otherwise. | 336 // Returns true if str ends with search, or false otherwise. |
| 337 BASE_EXPORT bool EndsWith(const std::string& str, | 337 BASE_EXPORT bool EndsWith(const std::string& str, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 #elif defined(WCHAR_T_IS_UTF32) | 527 #elif defined(WCHAR_T_IS_UTF32) |
| 528 typedef uint32 Unsigned; | 528 typedef uint32 Unsigned; |
| 529 #endif | 529 #endif |
| 530 }; | 530 }; |
| 531 template<> | 531 template<> |
| 532 struct ToUnsigned<short> { | 532 struct ToUnsigned<short> { |
| 533 typedef unsigned short Unsigned; | 533 typedef unsigned short Unsigned; |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 #endif // BASE_STRINGS_STRING_UTIL_H_ | 536 #endif // BASE_STRINGS_STRING_UTIL_H_ |
| OLD | NEW |