mirror of
https://github.com/golang/go
synced 2024-11-23 08:40:08 -07:00
path/filepath: add example for Match
Change-Id: Id2df4895a95904a607e54dd9810bfe97f5e12a73 Reviewed-on: https://go-review.googlesource.com/c/144105 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
9f7b1a8259
commit
7989119d17
@ -79,3 +79,18 @@ func ExampleJoin() {
|
||||
// a/b/c
|
||||
// a/b/c
|
||||
}
|
||||
|
||||
func ExampleMatch() {
|
||||
fmt.Println("On Unix:")
|
||||
fmt.Println(filepath.Match("/home/catch/*", "/home/catch/foo"))
|
||||
fmt.Println(filepath.Match("/home/catch/*", "/home/catch/foo/bar"))
|
||||
fmt.Println(filepath.Match("/home/?opher", "/home/gopher"))
|
||||
fmt.Println(filepath.Match("/home/\\*", "/home/*"))
|
||||
|
||||
// Output:
|
||||
// On Unix:
|
||||
// true <nil>
|
||||
// false <nil>
|
||||
// true <nil>
|
||||
// true <nil>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user