github.com/grafana/pyroscope@v1.18.0/pkg/util/strings.go (about) 1 // SPDX-License-Identifier: AGPL-3.0-only 2 // Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/pkg/util/strings.go 3 // Provenance-includes-license: Apache-2.0 4 // Provenance-includes-copyright: The Cortex Authors. 5 6 package util 7 8 // StringsContain returns true if the search value is within the list of input values. 9 func StringsContain(values []string, search string) bool { 10 for _, v := range values { 11 if search == v { 12 return true 13 } 14 } 15 16 return false 17 } 18 19 // StringsMap returns a map where keys are input values. 20 func StringsMap(values []string) map[string]bool { 21 out := make(map[string]bool, len(values)) 22 for _, v := range values { 23 out[v] = true 24 } 25 return out 26 }