feat: add HasKey

This commit is contained in:
dudaodong committed 2023-07-10 10:33:04 +08:00
1 parent 7b744c299e
commit 6f48b00c88
3 files changed
+49

No files matched your search

+17
View File
@@ -433,3 +433,20 @@ func ExampleMapTo() {
// <nil>
// {Nothin 28 123456789 {test 1}}
}
func ExampleHasKey() {
m := map[string]int{
"a": 1,
"b": 2,
}
result1 := HasKey(m, "a")
result2 := HasKey(m, "c")
fmt.Println(result1)
fmt.Println(result2)
// Output:
// true
// false
}