From cdcec9ca20b378b0de51cc2252bc80717a1c5799 Mon Sep 17 00:00:00 2001 From: Matt Pindell Date: Mon, 4 Jul 2016 13:58:21 -0600 Subject: [PATCH] Update "strings2.rs" link Add 1 new-line to the "strings2.rs" link on rust playground so that the hints at the bottom are completely obscured on initial load. Used the "Shorten Link" option from the Playground to create the new url. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46f4eb2..e885202 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ following exercises will ask you to make tests pass! [Relevant chapter in The Rust Programming Language](https://doc.rust-lang.org/stable/book/strings.html) - ["strings1.rs"](http://play.rust-lang.org/?code=%2F%2F+Make+me+compile+without+changing+the+function+signature%21+Scroll+down+for+hints+%3A%29%0A%0Afn+main%28%29+%7B%0A++++let+answer+%3D+current_favorite_color%28%29%3B%0A++++println%21%28%22My+current+favorite+color+is+%7B%7D%22%2C+answer%29%3B%0A%7D%0A%0Afn+current_favorite_color%28%29+-%3E+String+%7B%0A++++%22blue%22%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%2F%2F+The+%60current_favorite_color%60+function+is+currently+returning+a+string+slice+with+the+%60%27static%60%0A%2F%2F+lifetime.+We+know+this+because+the+data+of+the+string+lives+in+our+code+itself+--+it+doesn%27t%0A%2F%2F+come+from+a+file+or+user+input+or+another+program+--+so+it+will+live+as+long+as+our+program%0A%2F%2F+lives.+But+it+is+still+a+string+slice.+There%27s+one+way+to+create+a+%60String%60+by+converting+a%0A%2F%2F+string+slice+covered+in+the+Strings+chapter+of+the+book%2C+and+another+way+that+uses+the+%60From%60%0A%2F%2F+trait.%0A) -- ["strings2.rs"](http://play.rust-lang.org/?code=%2F%2F+Make+me+compile+without+changing+the+function+signature%21+Scroll+down+for+hints+%3A%29%0A%0Afn+main%28%29+%7B%0A++++let+word+%3D+String%3A%3Afrom%28%22green%22%29%3B+%2F%2F+Try+not+changing+this+line+%3A%29%0A++++if+is_a_color_word%28word%29+%7B%0A++++++++println%21%28%22That+is+a+color+word+I+know%21%22%29%3B%0A++++%7D+else+%7B%0A++++++++println%21%28%22That+is+not+a+color+word+I+know.%22%29%3B%0A++++%7D%0A%7D%0A%0Afn+is_a_color_word%28attempt%3A+%26str%29+-%3E+bool+%7B%0A++++attempt+%3D%3D+%22green%22+%7C%7C+attempt+%3D%3D+%22blue%22+%7C%7C+attempt+%3D%3D+%22red%22%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%2F%2F+Yes%2C+it+would+be+really+easy+to+fix+this+by+just+changing+the+value+bound+to+%60word%60+to+be+a%0A%2F%2F+string+slice+instead+of+a+%60String%60%2C+wouldn%27t+it%3F%3F+There+is+a+way+to+add+one+character+to+line%0A%2F%2F+5%2C+though%2C+that+will+coerce+the+%60String%60+into+a+string+slice.%0A) +- ["strings2.rs"](https://is.gd/d2Rjut) - ["strings3.rs"](http://play.rust-lang.org/?code=%2F%2F+Ok%2C+here+are+a+bunch+of+values--+some+are+%60Strings%60%2C+some+are+%60%26strs%60.+Your%0A%2F%2F+task+is+to+call+one+of+these+two+functions+on+each+value+depending+on+what%0A%2F%2F+you+think+each+value+is.+That+is%2C+add+either+%60string_slice%60+or+%60string%60%0A%2F%2F+before+the+parentheses+on+each+line.+If+you%27re+right%2C+it+will+compile%21%0A%0Afn+string_slice%28arg%3A+%26str%29+%7B+println%21%28%22%7B%7D%22%2C+arg%29%3B+%7D%0Afn+string%28arg%3A+String%29+%7B+println%21%28%22%7B%7D%22%2C+arg%29%3B+%7D%0A%0Afn+main%28%29+%7B%0A++++%28%22blue%22%29%3B%0A++++%28%22red%22.to_string%28%29%29%3B%0A++++%28String%3A%3Afrom%28%22hi%22%29%29%3B%0A++++%28%22rust+is+fun%21%22.to_owned%28%29%29%3B%0A++++%28%22nice+weather%22.into%28%29%29%3B%0A++++%28format%21%28%22Interpolation+%7B%7D%22%2C+%22Station%22%29%29%3B%0A++++%28%26String%3A%3Afrom%28%22abc%22%29%5B0..1%5D%29%3B%0A++++%28%22++hello+there+%22.trim%28%29%29%3B%0A++++%28%22Happy+Monday%21%22.to_string%28%29.replace%28%22Mon%22%2C+%22Tues%22%29%29%3B%0A++++%28%22mY+sHiFt+KeY+iS+sTiCkY%22.to_lowercase%28%29%29%3B%0A%7D%0A) ### Move semantics