macro_rules! starts_with {
    ($haystack: expr, $pattern: expr) => { ... };
}
Expand description

Returns true if the given pattern matches a prefix 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::starts_with!(BANANAS, "bana");
const B: bool = const_str::starts_with!(BANANAS, "nana");
const C: bool = const_str::starts_with!(BANANAS, 'b');
assert_eq!([A, B, C], [true, false, true]);