mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 17:40:57 +00:00
use base.TruncateString instead of TruncateRune
This commit is contained in:
parent
64cc883ac1
commit
2a1759ba3b
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