How To Split A String By Spaces Rust

[Solved] How To Split A String By Spaces Rust | Rust - Code Explorer | yomemimo.com
Question : how to split a string by spaces rust

Answered by : huldar

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());

Source : https://doc.rust-lang.org/std/string/struct.String.html | Last Update : Tue, 04 Aug 20

Answers related to how to split a string by spaces rust

Code Explorer Popular Question For Rust