mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: sivchari <shibuuuu5@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
14 lines
234 B
Go
14 lines
234 B
Go
package text
|
|
|
|
import (
|
|
"unicode/utf8"
|
|
)
|
|
|
|
// truncates messages to n characters
|
|
func Trunc(message string, n int) string {
|
|
if utf8.RuneCountInString(message) > n {
|
|
return string([]rune(message)[0:n-3]) + "..."
|
|
}
|
|
return message
|
|
}
|