macro_rules! contains { ($haystack: expr, $pattern: expr) => { ... }; }
Expand description
Returns true
if the given pattern matches a sub-slice of this string slice.
Returns false
if it does not.
The pattern type must be one of
§Examples
const BANANAS: &str = "bananas";
const A: bool = const_str::contains!(BANANAS, "nana");
const B: bool = const_str::contains!(BANANAS, "apples");
const C: bool = const_str::contains!(BANANAS, 'c');
assert_eq!([A, B, C], [true, false, false]);