1 package utils 2 3 func Ellipsis(text string, length int) string { 4 runes := []rune(text) 5 if len(runes) <= length { 6 return text 7 } 8 return string(runes[:length - 1]) + "…" 9 } 10
View as plain text