Fix string manipulation functions

This commit is contained in:
Rock070 2023-12-30 16:49:44 +08:00
parent c0768cc4da
commit 13c442ec31

View File

@ -3,21 +3,23 @@
// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn trim_me(input: &str) -> String {
// TODO: Remove whitespace from both ends of a string!
???
input.trim().to_string()
}
fn compose_me(input: &str) -> String {
// TODO: Add " world!" to the string! There's multiple ways to do this!
???
let mut s = String::new();
s.push_str(input);
s.push_str(" world!");
s
}
fn replace_me(input: &str) -> String {
// TODO: Replace "cars" in the string with "balloons"!
???
input.replace("cars", "balloons")
}
#[cfg(test)]