Question : how to concatenate two &str in rust
Answered by : mario-calcagno
// using 2 variables
let new_string = format!("{}{}", first_string, second_string);
// using 2 literals
let new_string = format!("{}{}", "first string ", "second string");
Source : | Last Update : Thu, 25 Mar 21
Question : rust concatenate strings
Answered by : mackerel
let text1 = "hello".to_owned();
let text2 = text1 + " world";
println!("{}", text2);
Source : | Last Update : Sun, 21 Mar 21
Question : rust concat
Answered by : maou-shimazu
let s = concat!("test", 10, 'b', true); // concatenates string literals
assert_eq!(s, "test10btrue");
Source : | Last Update : Fri, 25 Mar 22
Question : concat string rust
Answered by : ahmad-khaefi
fn main() { let mut string = String::from("Hello"); string.push_str(" World"); println!("{}", string);
}
Source : | Last Update : Thu, 02 Jun 22