Crates.io | blockcounter |
lib.rs | blockcounter |
version | 0.3.2 |
source | src |
created_at | 2017-12-21 20:16:46.132673 |
updated_at | 2018-07-17 02:38:53.795806 |
description | Counts the blocks in a stream. |
homepage | |
repository | https://github.com/kirch7/blockcounter |
max_upload_size | |
id | 43884 |
size | 18,568 |
Count blocks in a text.
extern crate blockcounter;
use blockcounter::{count_blocks, Blocks, clean};
fn main() {
let text = "0\n1\n\n2\n\n\n3\n\n".to_string();
println!("{}", text);
println!("===========");
println!("text has {} blocks.", count_blocks(2, text.as_bytes()));
println!("======================");
println!("");
for block in Blocks::new(2, text.as_bytes()) {
print!("{}", clean(&block));
println!("=============");
}
}