Files
lo/docs/data/core-trimright.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

678 B

name, slug, sourceRef, category, subCategory, playUrl, variantHelpers, similarHelpers, position, signatures
name slug sourceRef category subCategory playUrl variantHelpers similarHelpers position signatures
TrimRight trimright slice.go#L873 core slice https://go.dev/play/p/9V_N8sRyyiZ
core#slice#trimright
core#slice#trim
core#slice#trimleft
core#slice#trimprefix
core#slice#trimsuffix
0
func TrimRight[T comparable, Slice ~[]T](collection Slice, cutset Slice) Slice

Removes all trailing elements found in the cutset from the collection.

result := lo.TrimRight([]int{0, 1, 2, 0, 3, 0}, []int{0, 3})
// []int{0, 1, 2}

result = lo.TrimRight([]string{"hello", "world", "  "}, []string{" ", ""})
// []string{"hello", "world", ""}