pub const fn rsplit_terminator<'a, 'b>(
this: &'a str,
delim: &'b str,
) -> RSplitTerminator<'a, 'b>
Expand description
Const equivalent of str::rsplit_terminator
, which only takes a &str
delimiter.
The same as rsplit
,
except that, if the string before the first delimiter is empty, it is skipped.
§Version compatibility
This requires the "rust_1_64"
feature.
§Example
use konst::string;
use konst::iter::for_each;
const STRS: &[&str] = &{
let mut arr = [""; 3];
for_each!{(i, sub) in string::rsplit_terminator(":foo:bar:baz", ":"),enumerate() =>
arr[i] = sub;
}
arr
};
assert_eq!(STRS, ["baz", "bar", "foo"]);