Back to Lo

Core Trimright

docs/data/core-trimright.md

1.53.0270 B
Original Source

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

go
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", ""}