diff options
| author | mo8it <mo8it@proton.me> | 2024-06-28 02:48:21 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-06-28 02:48:21 +0200 |
| commit | eddbb97934b8d358b4fd20cc3063cf4872e39567 (patch) | |
| tree | 9c87060adb6ea6f2f713c759a84e6339fea163c1 /rustlings-macros/info.toml | |
| parent | 4f71f74b444ab35e0de0c4bd9a01a7e438057c01 (diff) | |
iterators2 solution
Diffstat (limited to 'rustlings-macros/info.toml')
| -rw-r--r-- | rustlings-macros/info.toml | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml index 5e93986..5a33788 100644 --- a/rustlings-macros/info.toml +++ b/rustlings-macros/info.toml @@ -894,7 +894,7 @@ https://doc.rust-lang.org/std/iter/trait.Iterator.html""" name = "iterators2" dir = "18_iterators" hint = """ -Step 1: +`capitalize_first`: 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`. @@ -905,12 +905,15 @@ The remaining characters in `c` can be viewed as a string slice using the The documentation for `char` contains many useful methods. https://doc.rust-lang.org/std/primitive.char.html -Step 2: +Use `char::to_uppercase`. It returns an iterator that can be converted to a +`String`. + +`capitalize_words_vector`: Create an iterator from the slice. Transform the iterated values by applying the `capitalize_first` function. Remember to `collect` the iterator. -Step 3: +`capitalize_words_string`: This is surprisingly similar to the previous solution. `collect` is very powerful and very general. Rust just needs to know the desired type.""" |
