photoprism/pkg/txt/empty.go
Michael Mayer 9d110e8b80 Search: Improve album, albums, lens, and camera filters #1994 #2079
Camera and lens can now also be searched by name. Escaping and parsing
of albums has been improved so that albums whose names start with and/or
contain numbers will be found.
2022-03-24 18:30:59 +01:00

23 lines
436 B
Go

package txt
import (
"strings"
)
// IsEmpty tests if a string represents an empty/invalid value.
func IsEmpty(s string) bool {
s = strings.Trim(strings.TrimSpace(s), "%*")
if s == "" || s == "0" || s == "-1" {
return true
}
s = strings.ToLower(s)
return s == "nil" || s == "null" || s == "nan"
}
// NotEmpty tests if a string does not represent an empty/invalid value.
func NotEmpty(s string) bool {
return !IsEmpty(s)
}