Commit 7989119d authored by Aurélien Rainone's avatar Aurélien Rainone Committed by Ian Lance Taylor

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: 's avatarIan Lance Taylor <iant@golang.org>
parent 9f7b1a82
......@@ -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>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment