start off the start of strings

This commit is contained in:
Steve Klabnik 2016-08-26 17:02:53 -04:00 committed by Carol (Nichols || Goulding)
parent c9a21c8e5d
commit 65691eeeed

View File

@ -3,16 +3,27 @@
We've already talked about strings a bunch in chapter four, but let's take a
more in-depth look at them now.
## creating
## Creating
You can create an empty string with `new`:
```rust
let s = String::new();
```
new, String::from and .to_string()
Often, you have some initial data that you'd like to start the string off with.
For that, there's the `.to_string()` method:
## reading
```rust
let data = "initial contents";
let s = data.to_string();
```
## Reading
slicing syntax, indexing
## updating
## Updating
push_str, concatenation