navidrome/utils/strings.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
423 B
Go
Raw Normal View History

2016-02-29 19:56:09 +01:00
package utils
import (
2016-03-02 19:18:39 +01:00
"strings"
2016-03-24 14:51:50 +01:00
2020-01-24 01:44:08 +01:00
"github.com/deluan/navidrome/conf"
2016-02-29 19:56:09 +01:00
)
func NoArticle(name string) string {
2020-01-24 07:29:31 +01:00
articles := strings.Split(conf.Server.IgnoredArticles, " ")
2016-02-29 19:56:09 +01:00
for _, a := range articles {
2016-03-02 19:18:39 +01:00
n := strings.TrimPrefix(name, a+" ")
if n != name {
2016-02-29 19:56:09 +01:00
return n
}
}
return name
}
func StringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}