1

the function is that it get a string and it has to give an output of words in that string in a vector or a list format.

What is a "word" for you?

3

(post deleted by author)

4

a string of chars what are spaced by a space

5

Well, by this definition:

fn main() {
    let text = "Hello world. What's hanging?";
    let words: Vec<_> = text.split_whitespace().collect();
    dbg!(words);
}

1 Like