MCPcopy
hub / github.com/cortexlabs/cortex / FindDuplicateStrs

Function FindDuplicateStrs

pkg/lib/slices/string.go:127–137  ·  view source on GitHub ↗
(in []string)

Source from the content-addressed store, hash-verified

125}
126
127func FindDuplicateStrs(in []string) []string {
128 dups := []string{}
129 keys := strset.New()
130 for _, elem := range in {
131 if keys.Has(elem) {
132 dups = append(dups, elem)
133 }
134 keys.Add(elem)
135 }
136 return dups
137}
138
139func SubtractStrSlice(slice1 []string, slice2 []string) []string {
140 result := []string{}

Callers 1

validateStringListFunction · 0.92

Calls 3

NewFunction · 0.92
HasMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected