[][src]Function simpleterm::text::split_word

pub fn split_word(x: &str, first_split: usize, rest_split: usize) -> Vec<String>

Returns a vector of strings corresponding to a word split up at the given number of characters. first_split may be smaller than rest_split to allow the first part of a word to fit on a line with previous words.

let long_word: &str = "supercalifragilisticexpialidocious";
assert_eq!(
    split_word(long_word, 5, 10),
    vec!(
        String::from("super"),
        String::from("califragil"),
        String::from("isticexpia"),
        String::from("lidocious"),
    )
);