1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-06 06:44:58 +01:00
Files
source-to-image/pkg/util/strings.go
2018-07-20 10:44:58 -04:00

22 lines
438 B
Go

package util
// Includes determines if the given string is in the provided slice of strings.
func Includes(arr []string, str string) bool {
for _, s := range arr {
if s == str {
return true
}
}
return false
}
// FirstNonEmpty returns the first non-empty string in the provided list of strings.
func FirstNonEmpty(args ...string) string {
for _, value := range args {
if len(value) > 0 {
return value
}
}
return ""
}