12 releases (breaking)
0.9.0 | Jan 30, 2025 |
---|---|
0.8.0 | Jun 2, 2023 |
0.7.2 | Nov 29, 2022 |
0.3.0 | Jul 19, 2022 |
0.1.1 | Jan 31, 2022 |
#164 in Command-line interface
71,670 downloads per month
Used in 129 crates
(5 directly)
105KB
2K
SLoC
ansi-str
![docs.rs](https://img.shields.io/badge/docs.rs-ansi--str-66c2a5?&color=blue&logo=docs.rs)
This is a library provides a set of methods to work with strings escaped with ansi code sequences.
It's an agnostic library in regard to different color libraries. Therefore it can be used with any library.
Usage
use ansi_str::AnsiStr;
pub fn main() {
let text = "\u{1b}[1m\u{1b}[31;46mWhen the night has come\u{1b}[0m\u{1b}[0m";
let cut = text.ansi_get(5..).expect("ok");
println!("{}", text);
println!("{}", cut);
}
Running this code will result in the following output.
For more examples, you check out the examples
directory.
Note
The library has derivatived from zhiburt/ansi-cut
Dependencies
~1MB
~23K SLoC