1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_STRINGS_PATTERN_H_ 6 #define BASE_STRINGS_PATTERN_H_ 7 8 #include <string_view> 9 10 #include "base/base_export.h" 11 12 namespace base { 13 14 // Returns true if the |string| passed in matches the |pattern|. The pattern 15 // string can contain wildcards like * and ?. 16 // 17 // The backslash character (\) is an escape character for * and ?. 18 // ? matches 0 or 1 character, while * matches 0 or more characters. 19 BASE_EXPORT bool MatchPattern(std::string_view string, 20 std::string_view pattern); 21 BASE_EXPORT bool MatchPattern(std::u16string_view string, 22 std::u16string_view pattern); 23 24 } // namespace base 25 26 #endif // BASE_STRINGS_PATTERN_H_ 27