Files
lo/docs/data/it-hassuffix.md
T
2025-10-08 19:35:53 +02:00

956 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/4RcKL5ie-p
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