photoprism/pkg/list/remove.go
Michael Mayer 884dea17de Security: Use individual preview tokens for each user account #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-10-13 22:11:02 +02:00

21 lines
372 B
Go

package list
// Remove removes a string from a list and returns it.
func Remove(list []string, s string) []string {
if len(list) == 0 || s == "" {
return list
} else if s == All {
return []string{}
}
result := make([]string, 0, len(list))
// Find matches.
for i := range list {
if s != list[i] {
result = append(result, list[i])
}
}
return result
}