remove emoji strings from display name

This commit is contained in:
Dan Anglin 2024-02-24 13:37:53 +00:00
parent f4af81947e
commit 0928803a34
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -1,6 +1,7 @@
package utilities
import (
"regexp"
"strings"
"time"
"unicode"
@ -63,7 +64,10 @@ func FieldFormat(text string) string {
}
func DisplayNameFormat(text string) string {
return boldmagenta + text + reset
// use this pattern to remove all emoji strings
pattern := regexp.MustCompile(`\s:[A-Za-z0-9]*:`)
return boldmagenta + pattern.ReplaceAllString(text, "") + reset
}
func FormatDate(date time.Time) string {