Macro const_str::strip_prefix
source · macro_rules! strip_prefix { ($s: expr, $prefix: expr) => { ... }; }
Expand description
Returns a string slice with the prefix removed.
§Examples
assert_eq!(const_str::strip_prefix!("foo:bar", "foo:"), Some("bar"));
assert_eq!(const_str::strip_prefix!("foo:bar", "bar"), None);
assert_eq!(const_str::strip_prefix!("foofoo", "foo"), Some("foo"));
const FOO_BAR: &str = "foo:bar";
const BAR: &str = const_str::unwrap!(const_str::strip_prefix!(FOO_BAR, "foo:"));
assert_eq!(BAR, "bar");