String / &str
Two text types: owned String and borrowed &str.
Syntax
let s = String::from("...");Description
String literals are &str. String is used for owned, growable text. len() gives the length. push_str appends.
Example
Loading editor…
Expected output
HexLibrary 10
When to use?
Text creation/manipulation.