4 个版本
使用旧的 Rust 2015
0.1.4 | 2023 年 8 月 22 日 |
---|---|
0.1.3 | 2023 年 7 月 15 日 |
0.1.2 | 2023 年 7 月 15 日 |
0.1.1 | 2023 年 7 月 15 日 |
在 文本处理 中排名 1753
每月下载 34 次
15KB
308 行
txt_processor

一个用于文本处理的迷你库。
特性
- 从文件读取文本
- 向文件追加/写入文本
- 修正文本中的空格
- 统计文本中的单词数量
- 统计文本中的行数
- 使用索引搜索单词
- 使用过滤器搜索单词
- 使用正则表达式搜索单词
- 统计单词的出现次数
用法
[dependencies]
txt_processor = "0.1.4"
示例
extern crate txt_processor;
use txt_processor::*;
fn main() {
let mut t = TxtProcessor::from_str(String::from("This is text for example!"));
t.replace_word("is", "replaced is");
assert_eq!(1, t.get_lines());
assert_eq!(5, t.get_words());
assert_eq!("This replaced is text for example!", t.get_content());
}
你可以在 示例 文件夹中找到更多示例
依赖项
~2.5–3.5MB
~62K SLoC