predicates::str

Function starts_with

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

Creates a new Predicate that ensures a str starts with pattern

ยงExamples

use predicates::prelude::*;

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