1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-03-01 00:35:28 +08:00

feat: add ContainsAll and ContainsAny

This commit is contained in:
dudaodong
2023-05-31 10:51:16 +08:00
parent 09ec5b97a6
commit 2894bec80c
3 changed files with 71 additions and 0 deletions
+31
View File
@@ -591,3 +591,34 @@ func ExampleHideString() {
// 132****8976
// 1324265****
}
func ExampleContainsAll() {
str := "hello world"
result1 := ContainsAll(str, []string{"hello", "world"})
result2 := ContainsAll(str, []string{"hello", "abc"})
fmt.Println(result1)
fmt.Println(result2)
// Output:
// true
// false
}
func ExampleContainsAny() {
str := "hello world"
result1 := ContainsAny(str, []string{"hello", "world"})
result2 := ContainsAny(str, []string{"hello", "abc"})
result3 := ContainsAny(str, []string{"123", "abc"})
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
// Output:
// true
// true
// false
}