mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-06-25 23:00:02 +02:00
use base.TruncateString instead of TruncateRune
This commit is contained in:
parent
bf65a783a6
commit
5bacff6fb8
3 changed files with 2 additions and 25 deletions
|
@ -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])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue