#string #iterator #edit #traits #associated

stringedits

stringedits provides the Edit trait and associated iterators for small edits to strings

6 releases

0.2.0 Feb 22, 2019
0.1.4 Feb 21, 2019

#1335 in Text processing


Used in spellcheck_toy

MIT license

19KB
320 lines

stringedits

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

Usage

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

Author

Written by Efron Licht (efron.python@gmail.com)

License

Available under the MIT License

No runtime deps