Function split

Source
pub const fn split<'a, 'b>(this: &'a str, delim: &'b str) -> Split<'a, 'b>
Expand description

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

§Version compatibility

This requires the "rust_1_64" feature.

§Example

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

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

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