Files
lo/docs/data/core-trimleft.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

31 lines
675 B
Markdown

---
name: TrimLeft
slug: trimleft
sourceRef: slice.go#L847
category: core
subCategory: slice
playUrl: https://go.dev/play/p/fJK-AhROy9w
variantHelpers:
- core#slice#trimleft
similarHelpers:
- core#slice#trim
- core#slice#trimright
- core#slice#trimprefix
- core#slice#trimsuffix
position: 0
signatures:
- "func TrimLeft[T comparable, Slice ~[]T](collection Slice, cutset Slice) Slice"
---
Removes all leading elements found in the cutset from the collection.
```go
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", " "}
```