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