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

675 B

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

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

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

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