19
info.toml
19
info.toml
@@ -704,21 +704,20 @@ path = "exercises/standard_library_types/iterators2.rs"
|
||||
mode = "test"
|
||||
hint = """
|
||||
Step 1
|
||||
You need to call something on `first` before it can be collected
|
||||
Currently its type is `char`. Have a look at the methods that are available on that type:
|
||||
The variable `first` is a `char`. It needs to be capitalized and added to the
|
||||
remaining characters in `c` in order to return the correct `String`.
|
||||
The remaining characters in `c` can be viewed as a string slice using the
|
||||
`as_str` method.
|
||||
The documentation for `char` contains many useful methods.
|
||||
https://doc.rust-lang.org/std/primitive.char.html
|
||||
|
||||
|
||||
Step 2
|
||||
First you'll need to turn the Vec into an iterator
|
||||
Then you'll need to apply your function unto each item in the vector
|
||||
P.s. Don't forget to collect() at the end!
|
||||
|
||||
Create an iterator from the slice. Transform the iterated values by applying
|
||||
the `capitalize_first` function. Remember to collect the iterator.
|
||||
|
||||
Step 3.
|
||||
This is very similar to the previous test. The only real change is that you will need to
|
||||
alter the type that collect is coerced into. For a bonus you could try doing this with a
|
||||
turbofish"""
|
||||
This is surprising similar to the previous solution. Collect is very powerful
|
||||
and very general. Rust just needs to know the desired type."""
|
||||
|
||||
[[exercises]]
|
||||
name = "iterators3"
|
||||
|
||||
Reference in New Issue
Block a user