predicates::str

Function similar

Source
pub fn similar<S>(orig: S) -> DifferencePredicate
where S: Into<Cow<'static, str>>,
Expand description

Creates a new Predicate that checks strings for how similar they are.

ยงExamples

use predicates::prelude::*;

let predicate_fn = predicate::str::similar("Hello World");
assert_eq!(true, predicate_fn.eval("Hello World"));
assert_eq!(false, predicate_fn.eval("Goodbye World"));