MCPcopy Create free account
hub / github.com/devops-works/scan-exporter / StringInSlice

Function StringInSlice

common/common.go:8–15  ·  view source on GitHub ↗

StringInSlice checks if a string appears in a slice.

(s string, sl []string)

Source from the content-addressed store, hash-verified

6
7// StringInSlice checks if a string appears in a slice.
8func StringInSlice(s string, sl []string) bool {
9 for _, v := range sl {
10 if v == s {
11 return true
12 }
13 }
14 return false
15}
16
17// CompareStringSlices checks if two slices are equal.
18// It returns the number of different items.

Callers 3

UpdaterMethod · 0.92
Test_StringInSliceFunction · 0.85
CompareStringSlicesFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_StringInSliceFunction · 0.68