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

32 lines
706 B
Markdown

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