Strings
String is the dynamic heap string type. When you need to modify or own the string. str is an immutable sequence of UTF-8 characters. A 'slice' of string data. Used behind a reference as &str.
To make a String from a &str: String::from("foo") or "foo".to_string() or let foo: String = "Hello world".into()
#![allow(unused)] fn main() { let data: String = "hello".into(); let s1: &str = &data; let s2: &str = &data; let s3: &str = &data; }
Literal Strings
#![allow(unused)] fn main() { r#"String content with " and / and \ and whatever"#; }
Modifying Strings
String is mutated via .push_str(&str).