mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
956 B
956 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| HasPrefix | hasprefix | it/find.go#L49 | it | find |
|
https://go.dev/play/p/3QbJK4hd-o |
|
|
20 |
Returns true if the collection has the specified prefix. The prefix can be specified as multiple arguments.
Examples:
seq := func(yield func(int) bool) {
_ = yield(1)
_ = yield(2)
_ = yield(3)
_ = yield(4)
}
hasPrefix := it.HasPrefix(seq, 1, 2)
// hasPrefix == true
seq := func(yield func(string) bool) {
_ = yield("hello")
_ = yield("world")
}
hasPrefix := it.HasPrefix(seq, "hello")
// hasPrefix == true
seq := func(yield func(int) bool) {
_ = yield(1)
_ = yield(2)
_ = yield(3)
}
hasPrefix := it.HasPrefix(seq, 2, 3)
// hasPrefix == false