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

Function RemoveString

pkg/lib/slices/string.go:105–114  ·  view source on GitHub ↗

RemoveString removes a target string from a string slice if it exists

(strs []string, target string)

Source from the content-addressed store, hash-verified

103
104// RemoveString removes a target string from a string slice if it exists
105func RemoveString(strs []string, target string) []string {
106 var result []string
107 for _, item := range strs {
108 if item == target {
109 continue
110 }
111 result = append(result, item)
112 }
113 return result
114}
115
116func HasDuplicateStr(in []string) bool {
117 keys := strset.New()

Callers 2

TestRemoveStringFunction · 0.92
ReconcileMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestRemoveStringFunction · 0.74