File: pattern.go

package info (click to toggle)
golang-github-twin-gocache 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 196 kB
  • sloc: makefile: 2
file content (12 lines) | stat: -rw-r--r-- 241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
package gocache

import "path/filepath"

// MatchPattern checks whether a string matches a pattern
func MatchPattern(pattern, s string) bool {
	if pattern == "*" {
		return true
	}
	matched, _ := filepath.Match(pattern, s)
	return matched
}