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