use base.TruncateString instead of TruncateRune

This commit is contained in:
Michael Jerger 2025-04-10 13:49:18 +02:00 committed by David Rotermund
parent bf65a783a6
commit 5bacff6fb8
3 changed files with 2 additions and 25 deletions

View file

@ -54,12 +54,3 @@ func SplitTrimSpace(input, sep string) []string {
return stringList
}
// TruncateRunes returns a truncated string with given rune limit,
// it returns input string if its rune length doesn't exceed the limit.
func TruncateRunes(str string, limit int) string {
if utf8.RuneCountInString(str) < limit {
return str
}
return string([]rune(str)[:limit])
}