Answers for "create string in rust"

2

rustlang string

let mut hello = String::from("Hello, ");

hello.push('w');
hello.push_str("orld!");
Posted by: Guest on March-23-2021
0

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"
Posted by: Guest on March-06-2021

Browse Popular Code Answers by Language