/txt_processor

A little library for text processing

Primary LanguageRustMIT LicenseMIT

txt_processor Package Documentation

A little library for text processing.

Features

  • Read text from file
  • Append/Write text to file
  • Fix spaces in text
  • Count words in text
  • Count lines in text
  • Search words with index
  • Search words with filter
  • Search words with regex
  • Count word's occurences

Usage

[dependencies]
txt_processor = "0.1.4"

Examples

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());
}

You can find more examples in examples folder