Files
lo/docs/data/core-droprightwhile.md
T
2025-10-06 17:15:49 +02:00

706 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
DropRightWhile droprightwhile slice.go#L486 core slice https://go.dev/play/p/3-n71oEC0Hz
core#slice#droprightwhile
core#slice#dropwhile
core#slice#drop
core#slice#dropright
core#slice#dropbyindex
core#slice#filterreject
core#slice#partitionby
200
func DropRightWhile[T any, Slice ~[]T](collection Slice, predicate func(item T) bool) Slice

Drops elements from the end while the predicate returns true.

lo.DropRightWhile([]string{"a", "aa", "aaa", "aa", "aa"}, func(val string) bool {
    return len(val) <= 2
})
// []string{"a", "aa", "aaa"}