Mutable string
-
push_str
-
If we initialize the varibale using
String::from
and make it mutable then we can change the string.
fn main() { let mut name = String::from("Foo"); println!("{name}"); name.push_str(" Bar"); println!("{name}"); }
Foo
Foo Bar