Files
lo/docs/data/it-trimfirst.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

665 B

name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures playUrl variantHelpers similarHelpers position
TrimFirst trimfirst it/seq.go#L778 it string
func TrimFirst[T comparable, I ~func(func(T) bool)](collection I, cutset ...T) I
https://go.dev/play/p/4D4Ke5C5MwH
it#string#trim
it#string#trimlast
263

TrimFirst removes all the leading cutset from the collection.

collection := func(yield func(int) bool) {
    yield(0)
    yield(0)
    yield(1)
    yield(2)
    yield(3)
}

trimmed := it.TrimFirst(collection, 0)
var result []int
for item := range trimmed {
    result = append(result, item)
}
// result contains [1, 2, 3]