mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-04-03 23:38:46 +02:00
19 lines
318 B
Go
19 lines
318 B
Go
package text
|
|
|
|
import (
|
|
"strings"
|
|
"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
|
|
}
|
|
|
|
func SemVer(s string) string {
|
|
return strings.ReplaceAll(s, "+", "")
|
|
}
|