added function to remove all ANSI-Codes from a string
1 files changed, 11 insertions(+), 0 deletions(-) A strip.go
A strip.go => strip.go +11 -0
@@ 0,0 1,11 @@ package ansi import "regexp" // StripString removes all ANSI-Escape sequences from the given string and // returns the cleaned version func StripString(str string) string { return DetectionPattern.ReplaceAllString(str, "") } var DetectionPattern = regexp.MustCompile(`(?m)((\x1b\[[;\d]*[A-Za-z])*)`)