Trait easy_shortcuts::traits::StringEx [] [src]

pub trait StringEx {
    fn split_at_delim(&self, delim: char) -> Option<(&str, &str)>;
fn split_at_delim_right(&self, delim: char) -> Option<(&str, &str)>;
fn is_whitespace(&self) -> bool; }

useful extra string operations

Required Methods

splits the string into two parts; the part before the delimiter and the part after the delimiter.

Example

use easy_shortcuts::traits::StringEx;

    let text = "one: two three";
    let res = text.split_at_delim(':');
    assert_eq!(res,Some(("one"," two three")));

splits the string into two parts; the part before the delimiter and the part after the delimiter. But this version searches from the right!

Example

use easy_shortcuts::traits::StringEx;

    let text = "one: two :three four";
    let res = text.split_at_delim_right(':');
    assert_eq!(res,Some(("one: two ","three four")));

does this string only contain whitespace?

Implementors