Function konst::string::rsplit_terminator

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

Const equivalent of str::rsplit_terminator.

This does the same as rsplit, except that, if the string before the first delimiter is empty, it is skipped.

This takes Pattern implementors as the delimiter.

§Example

use konst::string;
use konst::iter::collect_const;

const STRS: [&str; 3] = collect_const!(&str =>
    string::rsplit_terminator(":foo:bar:baz", ":")
);

assert_eq!(STRS, ["baz", "bar", "foo"]);