3 use word_utils::{first_word, second_word};
6 let s = String::from("Hello world");
7 println!("first word: '{}'", first_word(&s));
8 println!("second word: '{}'", second_word(&s).unwrap());
10 let s2 = "hello dude blah";
11 println!("second word of single: '{}'", second_word(s2).unwrap_or("(none)"));
13 match second_word(s2) {
14 Some(w) => println!("match: second word of '{}' exists: {}", s2, w),
15 None => println!("match: second word of '{}' does not exist", s2),