From 65f52921e21ad2e1c79d620fcfd01bde3ee30571 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sat, 25 Feb 2017 17:05:46 -0500 Subject: [PATCH] Don't start lines with #. to work around #199 Fixes #474. --- src/ch08-02-strings.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ch08-02-strings.md b/src/ch08-02-strings.md index 7b43f9ec8..7583ef296 100644 --- a/src/ch08-02-strings.md +++ b/src/ch08-02-strings.md @@ -158,9 +158,9 @@ fn add(self, s: &str) -> String { This isn’t the exact signature that’s in the standard library; there `add` is defined using generics. Here, we’re looking at the signature of `add` with concrete types substituted for the generic ones, which is what happens when we -call this method with `String` values. We'll be discussing generics in Chapter -10. This signature gives us the clues we need to understand the tricky bits of -the `+` operator. +call this method with `String` values. We'll be discussing generics in +Chapter 10. This signature gives us the clues we need to understand the tricky +bits of the `+` operator. First of all, `s2` has an `&`, meaning that we are adding a *reference* of the second string to the first string. This is because of the `s` parameter in the @@ -250,8 +250,8 @@ UTF-8. What about this example, though? let len = String::from("Здравствуйте").len(); ``` -A person asked how long the string is might say 12. However, Rust’s answer is -24. This is the number of bytes that it takes to encode “Здравствуйте” in +A person asked how long the string is might say 12. However, Rust’s answer +is 24. This is the number of bytes that it takes to encode “Здравствуйте” in UTF-8, since each Unicode scalar value takes two bytes of storage. Therefore, an index into the string’s bytes will not always correlate to a valid Unicode scalar value.