| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 314 // Performs a case-sensitive string compare. The behavior is undefined if both |
| 315 // strings are not ASCII. | 315 // strings are not ASCII. |
| 316 BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); | 316 BASE_EXPORT bool EqualsASCII(const string16& a, const StringPiece& b); |
| 317 | 317 |
| 318 // Returns true if str starts with search, or false otherwise. |
| 319 BASE_EXPORT bool StartsWithASCII(const std::string& str, |
| 320 const std::string& search, |
| 321 bool case_sensitive); |
| 322 BASE_EXPORT bool StartsWith(const base::string16& str, |
| 323 const base::string16& search, |
| 324 bool case_sensitive); |
| 325 |
| 318 } // namespace base | 326 } // namespace base |
| 319 | 327 |
| 320 #if defined(OS_WIN) | 328 #if defined(OS_WIN) |
| 321 #include "base/strings/string_util_win.h" | 329 #include "base/strings/string_util_win.h" |
| 322 #elif defined(OS_POSIX) | 330 #elif defined(OS_POSIX) |
| 323 #include "base/strings/string_util_posix.h" | 331 #include "base/strings/string_util_posix.h" |
| 324 #else | 332 #else |
| 325 #error Define string operations appropriately for your platform | 333 #error Define string operations appropriately for your platform |
| 326 #endif | 334 #endif |
| 327 | 335 |
| 328 // Returns true if str starts with search, or false otherwise. | |
| 329 BASE_EXPORT bool StartsWithASCII(const std::string& str, | |
| 330 const std::string& search, | |
| 331 bool case_sensitive); | |
| 332 BASE_EXPORT bool StartsWith(const base::string16& str, | |
| 333 const base::string16& search, | |
| 334 bool case_sensitive); | |
| 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, |
| 338 const std::string& search, | 338 const std::string& search, |
| 339 bool case_sensitive); | 339 bool case_sensitive); |
| 340 BASE_EXPORT bool EndsWith(const base::string16& str, | 340 BASE_EXPORT bool EndsWith(const base::string16& str, |
| 341 const base::string16& search, | 341 const base::string16& search, |
| 342 bool case_sensitive); | 342 bool case_sensitive); |
| 343 | 343 |
| 344 | 344 |
| 345 // Determines the type of ASCII character, independent of locale (the C | 345 // Determines the type of ASCII character, independent of locale (the C |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // string can contain wildcards like * and ? | 498 // string can contain wildcards like * and ? |
| 499 // The backslash character (\) is an escape character for * and ? | 499 // The backslash character (\) is an escape character for * and ? |
| 500 // We limit the patterns to having a max of 16 * or ? characters. | 500 // We limit the patterns to having a max of 16 * or ? characters. |
| 501 // ? matches 0 or 1 character, while * matches 0 or more characters. | 501 // ? matches 0 or 1 character, while * matches 0 or more characters. |
| 502 BASE_EXPORT bool MatchPattern(const base::StringPiece& string, | 502 BASE_EXPORT bool MatchPattern(const base::StringPiece& string, |
| 503 const base::StringPiece& pattern); | 503 const base::StringPiece& pattern); |
| 504 BASE_EXPORT bool MatchPattern(const base::string16& string, | 504 BASE_EXPORT bool MatchPattern(const base::string16& string, |
| 505 const base::string16& pattern); | 505 const base::string16& pattern); |
| 506 | 506 |
| 507 #endif // BASE_STRINGS_STRING_UTIL_H_ | 507 #endif // BASE_STRINGS_STRING_UTIL_H_ |
| OLD | NEW |