predicates::str

Function contains

Source
pub fn contains<P>(pattern: P) -> ContainsPredicate
where P: Into<String>,
Expand description

Creates a new Predicate that ensures a str contains pattern

ยงExamples

use predicates::prelude::*;

let predicate_fn = predicate::str::contains("Two");
assert_eq!(true, predicate_fn.eval("One Two Three"));
assert_eq!(false, predicate_fn.eval("Four Five Six"));