Back to Lo

Core Trim

docs/data/core-trim.md

1.53.0261 B
Original Source

Removes all leading and trailing elements in the cutset from the collection.

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

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