pub const fn rsplit<'a, 'p, P>(this: &'a str, delim: P) -> RSplit<'a, 'p, P>where
P: Pattern<'p>,
Expand description
Const equivalent of str::rsplit
.
This takes Pattern
implementors as the delimiter.
ยงExample
use konst::string;
use konst::iter::collect_const;
const STRS0: [&str; 3] = collect_const!(&str => string::rsplit("foo-bar-baz", "-"));
const STRS1: [&str; 3] = collect_const!(&str => string::rsplit("these are spaced", ' '));
assert_eq!(STRS0, ["baz", "bar", "foo"]);
assert_eq!(STRS1, ["spaced", "are", "these"]);