Answers for "how to split a string by spaces rust"

1

how to split a string by spaces rust

let mut iter = "A few words".split_whitespace();

assert_eq!(Some("A"), iter.next());
assert_eq!(Some("few"), iter.next());
assert_eq!(Some("words"), iter.next());

assert_eq!(None, iter.next());
Posted by: Guest on July-28-2020

Code answers related to "how to split a string by spaces rust"

Browse Popular Code Answers by Language