Function konst::string::contains

source ·
pub const fn contains<'a, P>(left: &str, pat: P) -> bool
where 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"));