| 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 <string> | 10 #include <string> |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 std::wstring::const_iterator a_end, | 267 std::wstring::const_iterator a_end, |
| 268 const char* b); | 268 const char* b); |
| 269 bool LowerCaseEqualsASCII(const char* a_begin, | 269 bool LowerCaseEqualsASCII(const char* a_begin, |
| 270 const char* a_end, | 270 const char* a_end, |
| 271 const char* b); | 271 const char* b); |
| 272 bool LowerCaseEqualsASCII(const wchar_t* a_begin, | 272 bool LowerCaseEqualsASCII(const wchar_t* a_begin, |
| 273 const wchar_t* a_end, | 273 const wchar_t* a_end, |
| 274 const char* b); | 274 const char* b); |
| 275 | 275 |
| 276 // Returns true if str starts with search, or false otherwise. | 276 // Returns true if str starts with search, or false otherwise. |
| 277 // This only works on ASCII strings. | |
| 278 bool StartsWithASCII(const std::string& str, | 277 bool StartsWithASCII(const std::string& str, |
| 279 const std::string& search, | 278 const std::string& search, |
| 280 bool case_sensitive); | 279 bool case_sensitive); |
| 280 bool StartsWith(const std::wstring& str, |
| 281 const std::wstring& search, |
| 282 bool case_sensitive); |
| 281 | 283 |
| 282 // Determines the type of ASCII character, independent of locale (the C | 284 // Determines the type of ASCII character, independent of locale (the C |
| 283 // library versions will change based on locale). | 285 // library versions will change based on locale). |
| 284 template <typename Char> | 286 template <typename Char> |
| 285 inline bool IsAsciiWhitespace(Char c) { | 287 inline bool IsAsciiWhitespace(Char c) { |
| 286 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; | 288 return c == ' ' || c == '\r' || c == '\n' || c == '\t'; |
| 287 } | 289 } |
| 288 template <typename Char> | 290 template <typename Char> |
| 289 inline bool IsAsciiAlpha(Char c) { | 291 inline bool IsAsciiAlpha(Char c) { |
| 290 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); | 292 return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // Returns true if the string passed in matches the pattern. The pattern | 521 // Returns true if the string passed in matches the pattern. The pattern |
| 520 // string can contain wildcards like * and ? | 522 // string can contain wildcards like * and ? |
| 521 // TODO(iyengar) This function may not work correctly for CJK strings as | 523 // TODO(iyengar) This function may not work correctly for CJK strings as |
| 522 // it does individual character matches. | 524 // it does individual character matches. |
| 523 // The backslash character (\) is an escape character for * and ? | 525 // The backslash character (\) is an escape character for * and ? |
| 524 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); | 526 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); |
| 525 bool MatchPattern(const std::string& string, const std::string& pattern); | 527 bool MatchPattern(const std::string& string, const std::string& pattern); |
| 526 | 528 |
| 527 #endif // BASE_STRING_UTIL_H_ | 529 #endif // BASE_STRING_UTIL_H_ |
| 528 | 530 |
| OLD | NEW |