You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/vendor/github.com/acarl005/stripansi
Miguel Mota 92e939902e
Add stripansi dependency
3 years ago
..
LICENSE Add stripansi dependency 3 years ago
README.md Add stripansi dependency 3 years ago
stripansi.go Add stripansi dependency 3 years ago

README.md

Strip ANSI

This Go package removes ANSI escape codes from strings.

Ideally, we would prevent these from appearing in any text we want to process. However, sometimes this can't be helped, and we need to be able to deal with that noise. This will use a regexp to remove those unwanted escape codes.

Install

$ go get -u github.com/acarl005/stripansi

Usage

import (
	"fmt"
	"github.com/acarl005/stripansi"
)

func main() {
	msg := "\x1b[38;5;140m foo\x1b[0m bar"
	cleanMsg := stripansi.Strip(msg)
	fmt.Println(cleanMsg) // " foo bar"
}