Back to Lo

Core Findindexof

docs/data/core-findindexof.md

1.53.0247 B
Original Source

Searches for an element based on a predicate and returns the element, its index, and a boolean indicating success.

go
val, idx, ok := lo.FindIndexOf([]string{"a", "b", "a", "b"}, func(i string) bool {
    return i == "b"
})
// "b", 1, true