4个版本 (2个重大更新)
0.3.1 | 2023年5月25日 |
---|---|
0.3.0 | 2023年5月25日 |
0.2.0 | 2023年5月21日 |
0.1.0 | 2023年5月4日 |
#1234 在 文本处理
每月41次下载
在 seven_seg 中使用
45KB
853 行
cattocol
此crate提供了各种合并文本的选项。
- 没有ANSI转义序列。
- 带有ANSI转义序列。
- 沿着第一文本的行。
- 迭代非空行。
示例
use cattocol::CatToCol;
let first_txt = String::from("It's a\nit's raining\nnortherly wind.");
let second_txt = String::from("beautiful day,\nwith a\n\n");
let cattocol = CatToCol::new().fill(' ').repeat(0);
let text = "It's a beautiful day,\nit's raining with a\nnortherly wind.\n";
let concatenated_txt = cattocol.combine_col(&first_txt, &second_txt).collect::<String>();
assert_eq!(concatenated_txt, text);
println!("{}", concatenated_txt);
//It's a beautiful day,
//it's raining with a
//northerly wind.
use cattocol::cat_to_col;
let first_txt = String::from("It's a\nit's raining\nnortherly wind.");
let second_txt = String::from("beautiful day,\nwith a\n\n");
let text = "It's a beautiful day,\nit's raining with a\nnortherly wind. \n";
let concatenated_txt = cat_to_col(&first_txt, &second_txt).collect::<String>();
assert_eq!(concatenated_txt, text);
println!("{}", concatenated_txt);
//It's a beautiful day,
//it's raining with a
//northerly wind.
use cattocol::by_pairs;
let first_txt = "one horsepower\ntwo horsepower\nthree horsepower\nfour horsepower\n";
let second_txt = "per horse\ntwo horses\n";
let concatenated_txt = by_pairs(first_txt, second_txt).collect::<String>();
assert_eq!( &concatenated_txt, "one horsepower per horse\ntwo horsepower two horses\n");
println!("{}", concatenated_txt);
//one horsepower per horse
//two horsepower two horses
许可证
GNU通用公共许可证v3.0
依赖项
~255–340KB