Function konst::string::trim_end_matches

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

A const subset of str::trim_end_matches.

This takes Pattern implementors as the needle.

§Example

use konst::string;

const CHAR_TRIMMED: &str = string::trim_end_matches("oowowooooo", 'o');
const STR_TRIMMED: &str = string::trim_end_matches("oowowooooo", "oo");

assert_eq!(CHAR_TRIMMED, "oowow");
assert_eq!(STR_TRIMMED, "oowowo");