slice_diff

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 1 Imported by: 1

README

Go Reference

Slice Diff

Returns the difference between two slices

Installation
go get github.com/mtdevs28080617/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}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SliceDiff

func SliceDiff[T constraints.Ordered](listA []T, listB []T) []T

SliceDiff takes 2 slices of the same type and returns the difference The difference returned is what listB does not match within listA

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL