pub const fn split_terminator<'a, 'b>(
    this: &'a str,
    delim: &'b str
) -> SplitTerminator<'a, 'b>
Available on crate feature rust_1_64 only.
Expand description

Const equivalent of str::split_terminator, which only takes a &str delimiter.

The same as split, except that, if the string after the last 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::split_terminator("foo,bar,baz,", ","),enumerate() =>
        arr[i] = sub;
    }
    arr
};

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