Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: base/strings/string_util.h

Issue 962673004: [Autofill/Autocomplete Feature] Substring matching instead of prefix matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses review comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Returns true if the string passed in matches the pattern. The pattern 493 // Returns true if the string passed in matches the pattern. The pattern
494 // string can contain wildcards like * and ? 494 // string can contain wildcards like * and ?
495 // The backslash character (\) is an escape character for * and ? 495 // The backslash character (\) is an escape character for * and ?
496 // We limit the patterns to having a max of 16 * or ? characters. 496 // We limit the patterns to having a max of 16 * or ? characters.
497 // ? matches 0 or 1 character, while * matches 0 or more characters. 497 // ? matches 0 or 1 character, while * matches 0 or more characters.
498 BASE_EXPORT bool MatchPattern(const base::StringPiece& string, 498 BASE_EXPORT bool MatchPattern(const base::StringPiece& string,
499 const base::StringPiece& pattern); 499 const base::StringPiece& pattern);
500 BASE_EXPORT bool MatchPattern(const base::string16& string, 500 BASE_EXPORT bool MatchPattern(const base::string16& string,
501 const base::string16& pattern); 501 const base::string16& pattern);
502 502
503 // Returns offset to the beginning of first occurence of |search| in the |str|.
504 // If no such subsequence is found, |base::string16::npos| is returned.
505 BASE_EXPORT base::string16::size_type StartsAt(const base::string16& str,
Evan Stade 2015/03/31 21:41:52 I think you want to call this Find. You'll need a
506 const base::string16& search,
507 bool case_sensitive);
508
503 // Hack to convert any char-like type to its unsigned counterpart. 509 // Hack to convert any char-like type to its unsigned counterpart.
504 // For example, it will convert char, signed char and unsigned char to unsigned 510 // For example, it will convert char, signed char and unsigned char to unsigned
505 // char. 511 // char.
506 template<typename T> 512 template<typename T>
507 struct ToUnsigned { 513 struct ToUnsigned {
508 typedef T Unsigned; 514 typedef T Unsigned;
509 }; 515 };
510 516
511 template<> 517 template<>
512 struct ToUnsigned<char> { 518 struct ToUnsigned<char> {
(...skipping 10 matching lines...) Expand all
523 #elif defined(WCHAR_T_IS_UTF32) 529 #elif defined(WCHAR_T_IS_UTF32)
524 typedef uint32 Unsigned; 530 typedef uint32 Unsigned;
525 #endif 531 #endif
526 }; 532 };
527 template<> 533 template<>
528 struct ToUnsigned<short> { 534 struct ToUnsigned<short> {
529 typedef unsigned short Unsigned; 535 typedef unsigned short Unsigned;
530 }; 536 };
531 537
532 #endif // BASE_STRINGS_STRING_UTIL_H_ 538 #endif // BASE_STRINGS_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/strings/string_util.cc » ('j') | components/autofill/content/renderer/form_autofill_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698