|
|
@@ -2,10 +2,14 @@ fn main() {
|
|
2
|
2
|
println!("Hello, world!");
|
|
3
|
3
|
}
|
|
4
|
4
|
|
|
5
|
|
-fn concatenate_strings(){
|
|
|
5
|
+/// Concats the two given String *references* and returns them as a String.
|
|
|
6
|
+fn concatenate_strings<'a>(s1:&'a str, s2:&'a str) -> String {
|
|
|
7
|
+ s1.to_string() + s2
|
|
6
|
8
|
}
|
|
7
|
9
|
|
|
8
|
|
-fn split_into_strings(){
|
|
|
10
|
+/// Splits the given String *reference* and returns it as Vector of Strings.
|
|
|
11
|
+fn split_into_strings<'a>(s1:&'a str) -> Vec<String> {
|
|
|
12
|
+ s1.to_string().split_whitespace().collect()
|
|
9
|
13
|
}
|
|
10
|
14
|
|
|
11
|
15
|
fn sum_strings(){
|