Crates.io | stringedits |
lib.rs | stringedits |
version | 0.2.0 |
source | src |
created_at | 2019-02-21 00:02:31.246159 |
updated_at | 2019-02-22 22:43:24.699332 |
description | stringedits provides the Edit trait and associated iterators for small edits to strings. |
homepage | |
repository | https://gitlab.com/efronlicht/stringedits |
max_upload_size | |
id | 116100 |
size | 20,608 |
The stringedits
package contains the Edit
trait & associated iterators for simple edits of strings
This is primarially a library crate for the project spellcheck_toy
Add stringedits = "0.1.4" under [dependencies] in your Cargo.toml, then bring the Edit trait into scope.
use stringedits::Edit;
let replaces = "ab".replaces().collect::<Vec<String>>().join(" ");
let want = concat!(
"ab bb cb db eb fb gb hb ib jb kb lb mb nb ob pb qb rb sb tb ub vb wb xb yb zb ", // replace first character, 'a'
"aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az", // replace second character, 'b'
);
assert_eq!(want, replaces);
Written by Efron Licht (efron.python@gmail.com)
Available under the MIT License