konst::string

Function 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");