diff options
| author | liv <liv@fastmail.com> | 2019-01-23 20:48:01 +0100 |
|---|---|---|
| committer | liv <liv@fastmail.com> | 2019-01-23 20:48:01 +0100 |
| commit | dc1f3b79f8b528659e39057ac733d07e1051bc4d (patch) | |
| tree | 5461c32ea18c38e89ac96d9baba3d7ea4b2ac9f3 /exercises/test3.rs | |
| parent | 141db7795b23d066a2b7c798d16c96ff53aa5a52 (diff) | |
add tests; refactor exercise links
Diffstat (limited to 'exercises/test3.rs')
| -rwxr-xr-x | exercises/test3.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/exercises/test3.rs b/exercises/test3.rs new file mode 100755 index 0000000..e94b069 --- /dev/null +++ b/exercises/test3.rs @@ -0,0 +1,24 @@ +// strings3.rs +// This is a test for the following sections: +// - Strings + +// Ok, here are a bunch of values-- some are `Strings`, some are `&strs`. Your +// task is to call one of these two functions on each value depending on what +// you think each value is. That is, add either `string_slice` or `string` +// before the parentheses on each line. If you're right, it will compile! + +fn string_slice(arg: &str) { println!("{}", arg); } +fn string(arg: String) { println!("{}", arg); } + +fn main() { + ("blue"); + ("red".to_string()); + (String::from("hi")); + ("rust is fun!".to_owned()); + ("nice weather".into()); + (format!("Interpolation {}", "Station")); + (&String::from("abc")[0..1]); + (" hello there ".trim()); + ("Happy Monday!".to_string().replace("Mon", "Tues")); + ("mY sHiFt KeY iS sTiCkY".to_lowercase()); +} |
