Split string once on the first whitespace in Rust
Advertisements I have a string, say "dog cat fish", that I want to split on the first whitespace into two slices that look like this: ("dog", "cat fish"). I tried to naively use the split_once() method like this: let string = "dog cat fish"; let (first_word, rest_of_string) = string.split_once(‘ ‘).unwrap(); It works effectively for regular… Read More Split string once on the first whitespace in Rust