mark2web/pkg/helper/string.go
Sebastian Frank 4cb09fb81f
All checks were successful
continuous-integration/drone/push Build is passing
local collections for docu in website
2019-03-25 15:33:53 +01:00

17 lines
265 B
Go

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