convert_case

Function split

Source
pub fn split<'s, T>(s: &'s T, boundaries: &[Boundary]) -> Vec<&'s str>
where T: AsRef<str>,
Expand description

Split an identifier into a list of words using the list of boundaries.

This is used internally for splitting an identifier before mutating by a pattern and joining again with a delimiter.

use convert_case::{Boundary, split};
assert_eq!(
    vec!["one", "two", "three.four"],
    split(&"one_two-three.four", &[Boundary::UNDERSCORE, Boundary::HYPHEN]),
)