Stage 7.10: String
A String is a struct that owns a sequence of utf-8 bytes in heap memory.
Because its memory is on the heap, it can be extended, modified, etc. in ways string literals cannot.
Common methods are:
push_strto add more utf-8 bytes to the end of a string.replaceto replace sequences of utf-8 bytes with others.to_lowercase/to_uppercasefor case changes.trimfor trimming space
When a String is dropped, its heap memory is also dropped.
String has a + operator that extends the string with a
&str and returns itself, but it might not be as ergonomic as you hope for.
Further information:
