Copy Inslice() to those parts that use it

Signed-off-by: Chao Wang <wangchao.fnst@cn.fujitsu.com>
Upstream-commit: 5c154cfac89305f7ca9446854e56700e8a660f93
Component: engine
This commit is contained in:
Chao Wang
2017-11-10 13:18:48 +08:00
parent 32672a8e2b
commit 98da414257
7 changed files with 49 additions and 47 deletions

View File

@ -41,17 +41,6 @@ func Truncate(s string, maxlen int) string {
return string(r[:maxlen])
}
// InSlice tests whether a string is contained in a slice of strings or not.
// Comparison is case insensitive
func InSlice(slice []string, s string) bool {
for _, ss := range slice {
if strings.ToLower(s) == strings.ToLower(ss) {
return true
}
}
return false
}
func quote(word string, buf *bytes.Buffer) {
// Bail out early for "simple" strings
if word != "" && !strings.ContainsAny(word, "\\'\"`${[|&;<>()~*?! \t\n") {