photoprism/pkg/txt/clip.go
Michael Mayer 1cbb0a6d56 Labels: Edit name in overview #212
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-02-02 02:00:47 +01:00

19 lines
217 B
Go

package txt
import "strings"
func Clip(s string, size int) string {
if s == "" {
return ""
}
s = strings.TrimSpace(s)
runes := []rune(s)
if len(runes) > size {
s = string(runes[0:size-1])
}
return s
}