How To Concatenate Two &str In Rust

[Solved] How To Concatenate Two &str In Rust | Rust - Code Explorer | yomemimo.com
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

Answers related to how to concatenate two &str in rust

Code Explorer Popular Question For Rust