photoprism/pkg/txt/quote.go

21 lines
402 B
Go
Raw Normal View History

package txt
import (
"fmt"
"strings"
)
// Quote adds quotation marks to a string if needed.
func Quote(text string) string {
if text == "" || strings.ContainsAny(text, " \n'\"") {
return fmt.Sprintf("“%s”", text)
}
return text
}
2021-09-23 23:46:17 +02:00
// QuoteLower converts a string to lowercase and adds quotation marks if needed.
func QuoteLower(text string) string {
return Quote(strings.ToLower(text))
}