pub const fn contains<'a, P>(left: &str, pat: P) -> boolwhere
P: Pattern<'a>,
Expand description
A const equivalent of
str::contains
, taking a Pattern
parameter.
ยงExample
use konst::string;
assert!(string::contains("foo-bar-baz", '-'));
assert!(!string::contains("foo-bar-baz", 'q'));
assert!(string::contains("foo-bar-baz-foo", "foo"));
assert!( string::contains("foo-bar-baz-foo-bar", "bar"));
assert!(!string::contains("foo-he-baz-foo-he", "bar"));