mark2web/pkg/helper/string.go
2019-03-25 14:01:28 +01:00

14 lines
235 B
Go

package helper
// ShortenStringLeft shortens a string
func ShortenStringLeft(str string, num int) string {
tstr := str
if len(str) > num {
if num > 3 {
num -= 3
}
tstr = "..." + str[len(str)-num:len(str)]
}
return tstr
}