pattern.h 787 B

1234567891011121314151617181920212223
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_STRINGS_PATTERN_H_
  5. #define BASE_STRINGS_PATTERN_H_
  6. #include "base/base_export.h"
  7. #include "base/strings/string_piece.h"
  8. namespace base {
  9. // Returns true if the |string| passed in matches the |pattern|. The pattern
  10. // string can contain wildcards like * and ?.
  11. //
  12. // The backslash character (\) is an escape character for * and ?.
  13. // ? matches 0 or 1 character, while * matches 0 or more characters.
  14. BASE_EXPORT bool MatchPattern(StringPiece string, StringPiece pattern);
  15. BASE_EXPORT bool MatchPattern(StringPiece16 string, StringPiece16 pattern);
  16. } // namespace base
  17. #endif // BASE_STRINGS_PATTERN_H_