Macro strip_prefix
macro_rules! strip_prefix {
($s: expr, $prefix: expr) => { ... };
}
Available on crate feature
dep_const_str
only.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");