Expand description
A UTF-8 encoded, growable string.
The String2
type is string type that has owership over the char.
§Example
You can create a String2
from a literal string with String2::from
:
use string2::String2;
let hello = String2::from("hello, world!");
You can append a char
to a String2
with the push
method, and
append a &str
with the push_str
method;
use string2::String2;
let mut hello = String2::from("Hello, ");
hello.push('w');
hello.push_str("orld!");
If you have a String
, you can create a String2
from it with the
from
method, and you can convert String2
to String
whit the
into
method:
use string2::String2;
let hello = String::from("Hello world!");
let world = String2::from(hello);
let hello_world: String = world.into();
Structs§
- StrIterator
- String2
- A UTF-8 encoded, growable string.