Split string on whitespace
- split_whitespace
fn main() { let text = "mouse cat cat oliphant"; let parts = text.split_whitespace(); // println!("{:?}", parts); for part in parts { println!("{}", part); } }
mouse
cat
cat
oliphant
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
fn main() { let text = "mouse cat cat oliphant"; let parts = text.split_whitespace(); // println!("{:?}", parts); for part in parts { println!("{}", part); } }
mouse
cat
cat
oliphant