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

955 B

name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
name slug sourceRef category subCategory signatures playUrl variantHelpers similarHelpers position
HasSuffix hassuffix it/find.go#L71 it find
func HasSuffix[T comparable](collection iter.Seq[T], suffix ...T) bool
https://go.dev/play/p/r6bF9Rmq5S0
it#find#hassuffix
core#slice#hassuffix
it#find#hasprefix
30

Returns true if the collection has the specified suffix. The suffix can be specified as multiple arguments.

Examples:

seq := func(yield func(int) bool) {
    _ = yield(1)
    _ = yield(2)
    _ = yield(3)
    _ = yield(4)
}
hasSuffix := it.HasSuffix(seq, 3, 4)
// hasSuffix == true
seq := func(yield func(string) bool) {
    _ = yield("hello")
    _ = yield("world")
}
hasSuffix := it.HasSuffix(seq, "world")
// hasSuffix == true
seq := func(yield func(int) bool) {
    _ = yield(1)
    _ = yield(2)
    _ = yield(3)
}
hasSuffix := it.HasSuffix(seq, 1, 2)
// hasSuffix == false