konst::string

Function trim_matches

Source
pub const fn trim_matches<'a, 'p, P>(this: &'a str, needle: P) -> &'a str
where P: Pattern<'p>,
Expand description

A const subset of str::trim_matches.

This takes Pattern implementors as the needle.

ยงExample

use konst::string;

const CHAR_TRIMMED: &str = string::trim_matches("---baz qux---", '-');
const STR_TRIMMED: &str = string::trim_matches("<>baz qux<><><>", "<>");

assert_eq!(CHAR_TRIMMED, "baz qux");
assert_eq!(STR_TRIMMED, "baz qux");