Files
lo/docs/data/core-intersectby.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

33 lines
784 B
Markdown

---
name: IntersectBy
slug: intersectby
sourceRef: intersect.go#L174
category: core
subCategory: intersect
playUrl: https://go.dev/play/p/uWF8y2-zmtf
variantHelpers:
- core#intersect#intersectby
similarHelpers:
- core#intersect#intersect
- it#intersect#intersect
- it#intersect#intersectby
- core#intersect#difference
- core#intersect#union
- core#intersect#without
- core#slice#uniq
position: 80
signatures:
- "func IntersectBy[T any, K comparable, Slice ~[]T](transform func(T) K, lists ...Slice) Slice"
---
Returns the intersection between two collections using a custom key selector function.
```go
transform := func(v int) string {
return strconv.Itoa(v)
}
lo.IntersectBy(transform, []int{0, 3, 5, 7}, []int{3, 5}, []int{0, 1, 2, 0, 3, 0})
// []int{3}
```