mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
814 B
814 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| LastIndexOf | lastindexof | it/find.go#L34 | it | find |
|
https://go.dev/play/p/2PaIZ3gc-n |
|
|
10 |
Returns the index at which the last occurrence of a value is found in the sequence, or -1 if the value is not found.
Examples:
seq := func(yield func(int) bool) {
_ = yield(10)
_ = yield(20)
_ = yield(30)
_ = yield(20)
}
idx := it.LastIndexOf(seq, 20)
// idx == 3
seq := func(yield func(string) bool) {
_ = yield("apple")
_ = yield("banana")
_ = yield("cherry")
}
idx := it.LastIndexOf(seq, "orange")
// idx == -1