rust string code example
Example 1: rustlang string
let mut hello = String::from("Hello, ");
hello.push('w');
hello.push_str("orld!");
Example 2: rust format string
format!("Hello"); // => "Hello"
format!("Hello, {}!", "world"); // => "Hello, world!"
format!("The number is {}", 1); // => "The number is 1"
format!("{:?}", (3, 4)); // => "(3, 4)"
format!("{value}", value=4); // => "4"
format!("{} {}", 1, 2); // => "1 2"