matt9mg / go-slice-diff

Returns the difference between two slices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Reference

Slice Diff

Returns the difference between two slices

Installation

go get github.com/matt9mg/go-slice-diff

Examples

listA := []string{"A", "B", "C"}
listB := []string{"A", "B", "D"}

diff := slice_diff.SliceDiff[string](listA, listB)

log.Println(diff) // []string{"D"}

listA := []int{1, 2, 3}
listB := []int{1, 2, 4}

diff := slice_diff.SliceDiff[int](listA, listB)

log.Println(diff) // []int{4}

About

Returns the difference between two slices

License:MIT License


Languages

Language:Go 100.0%