Documentation ¶
Overview ¶
Package ansi provides methods for working with ANSI/VT100 control sequences
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasCodes ¶
HasCodes returns true if given string contains ANSI/VT100 control sequences
Example ¶
input := "Hello" fmt.Println(HasCodes(input)) input = "\033[40;38;5;82mHello\x1B[0m" fmt.Println(HasCodes(input))
Output: false true
func HasCodesBytes ¶
HasCodes returns true if given byte slice contains ANSI/VT100 control sequences
Example ¶
input := []byte("Hello") fmt.Println(HasCodesBytes(input)) input = []byte("\033[40;38;5;82mHello\x1B[0m") fmt.Println(HasCodesBytes(input))
Output: false true
func RemoveCodes ¶
RemoveCodesBytes returns string without all ANSI/VT100 control sequences
Example ¶
input := "\033[40;38;5;82mHello\x1B[0m" fmt.Println(RemoveCodes(input))
Output: Hello
func RemoveCodesBytes ¶
RemoveCodesBytes returns byte slice without all ANSI/VT100 control sequences
Example ¶
input := []byte("\033[40;38;5;82mHello\x1B[0m") fmt.Println(string(RemoveCodesBytes(input)))
Output: Hello
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.