Rust Iterate Over Split

[Solved] Rust Iterate Over Split | Perl - Code Explorer | yomemimo.com
Question : rust iterate over split

Answered by : snefden-applications

let mut split = "some string 123 ffd".split("123");
//	This gives an iterator, which you can loop over, or collect() into a vector.
for s in split { println!("{}", s)
}
let vec = split.collect::<Vec<&str>>();
// OR
let vec: Vec<&str> = split.collect();

Source : https://stackoverflow.com/questions/26643688/how-do-i-split-a-string-in-rust | Last Update : Sat, 14 May 22

Answers related to rust iterate over split

Code Explorer Popular Question For Perl