1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 14:42:27 +08:00

feat: add FindLastBy function

This commit is contained in:
dudaodong
2023-04-17 20:17:26 +08:00
parent 14bc08c6d6
commit 52ea64bc33
3 changed files with 56 additions and 0 deletions

View File

@@ -358,6 +358,23 @@ func ExampleFindBy() {
// true
}
func ExampleFindLastBy() {
nums := []int{1, 2, 3, 4, 5}
isEven := func(i, num int) bool {
return num%2 == 0
}
result, ok := FindLastBy(nums, isEven)
fmt.Println(result)
fmt.Println(ok)
// Output:
// 4
// true
}
func ExampleFlatten() {
arrs := [][][]string{{{"a", "b"}}, {{"c", "d"}}}