1 unstable release
Uses old Rust 2015
0.1.4 | Jul 13, 2018 |
---|
#12 in #growable
25KB
376 lines
str
lib.rs
:
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();