Added termext.CleanString
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package termext
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
colorReset = "\033[0m"
|
||||
colorRed = "\033[31m"
|
||||
@@ -43,3 +45,17 @@ func Gray(v string) string {
|
||||
func White(v string) string {
|
||||
return colorWhite + v + colorReset
|
||||
}
|
||||
|
||||
func CleanString(v string) string {
|
||||
v = strings.ReplaceAll(v, colorReset, "")
|
||||
v = strings.ReplaceAll(v, colorRed, "")
|
||||
v = strings.ReplaceAll(v, colorGreen, "")
|
||||
v = strings.ReplaceAll(v, colorYellow, "")
|
||||
v = strings.ReplaceAll(v, colorBlue, "")
|
||||
v = strings.ReplaceAll(v, colorPurple, "")
|
||||
v = strings.ReplaceAll(v, colorCyan, "")
|
||||
v = strings.ReplaceAll(v, colorGray, "")
|
||||
v = strings.ReplaceAll(v, colorWhite, "")
|
||||
|
||||
return v
|
||||
}
|
||||
|
Reference in New Issue
Block a user