mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
31 lines
675 B
Markdown
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", " "}
|
|
```
|
|
|
|
|