strip_ansi_escapes

Function strip_str

Source
pub fn strip_str<T>(data: T) -> String
where T: AsRef<str>,
Expand description

Strip ANSI escapes from data and return the remaining contents as a String.

ยงExample

let str_with_colors = "\x1b[32mfoo\x1b[m bar";
let string_without_colors = strip_ansi_escapes::strip_str(str_with_colors);
assert_eq!(string_without_colors, "foo bar");