Back to Lo

Core Droprightwhile

docs/data/core-droprightwhile.md

1.53.0212 B
Original Source

Drops elements from the end while the predicate returns true.

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