Trait ToSegmentsFromChars

Source
pub trait ToSegmentsFromChars {
    // Required methods
    fn split_on_any_char(&self, separators: &[char]) -> Vec<String>;
    fn to_head_tail_on_any_char(&self, separators: &[char]) -> (String, String);
    fn to_start_end_on_any_char(&self, separators: &[char]) -> (String, String);
}
Expand description

Methods to split a &str/String on the first matched separator character

Required Methods§

Source

fn split_on_any_char(&self, separators: &[char]) -> Vec<String>

Split a string into parts separated by any of the referenced split characters

Source

fn to_head_tail_on_any_char(&self, separators: &[char]) -> (String, String)

Split a string into a head and tail separated by the first instance of the first matching separator If none of the separators are matched, the first element is an empty string and the second the whole string

Source

fn to_start_end_on_any_char(&self, separators: &[char]) -> (String, String)

Split a string into s start and tail separated by the last instance of the first matching separator If none of the separators are matched, the first element is an empty string and the second the whole string

Implementations on Foreign Types§

Source§

impl ToSegmentsFromChars for str

Source§

fn split_on_any_char(&self, separators: &[char]) -> Vec<String>

Split a string on any of the referenced characters

Source§

fn to_head_tail_on_any_char(&self, separators: &[char]) -> (String, String)

Split into head and tail components on the first occurrence of any of the referenced characters

Source§

fn to_start_end_on_any_char(&self, separators: &[char]) -> (String, String)

Split into start and end components on the last occurrence of any of the referenced characters

Implementors§