mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-15 06:38:50 +01:00
chore: add tests for all utils, removed unused functions
This commit is contained in:
parent
b4c7cac964
commit
3cba5f70fd
7 changed files with 275 additions and 188 deletions
|
|
@ -16,28 +16,3 @@ func NoArticle(name string) string {
|
|||
}
|
||||
return name
|
||||
}
|
||||
|
||||
func LongestCommonPrefix(list []string) string {
|
||||
if len(list) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
for l := 0; l < len(list[0]); l++ {
|
||||
c := list[0][l]
|
||||
for i := 1; i < len(list); i++ {
|
||||
if l >= len(list[i]) || list[i][l] != c {
|
||||
return list[i][0:l]
|
||||
}
|
||||
}
|
||||
}
|
||||
return list[0]
|
||||
}
|
||||
|
||||
func StringInSlice(a string, list []string) bool {
|
||||
for _, b := range list {
|
||||
if b == a {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue