| 
									
										
										
										
											2020-05-19 11:47:44 -05:00
										 |  |  | // quiz2.rs
 | 
					
						
							|  |  |  | // This is a quiz for the following sections:
 | 
					
						
							| 
									
										
										
										
											2019-11-11 06:46:42 -06:00
										 |  |  | // - Strings
 | 
					
						
							| 
									
										
										
										
											2019-01-23 13:48:01 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-13 05:38:14 -05:00
										 |  |  | // Ok, here are a bunch of values-- some are `String`s, some are `&str`s. Your
 | 
					
						
							| 
									
										
										
										
											2019-11-11 06:46:42 -06:00
										 |  |  | // 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!
 | 
					
						
							| 
									
										
										
										
											2015-09-20 17:31:41 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-11 06:38:24 -06:00
										 |  |  | // I AM NOT DONE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-11 06:46:42 -06:00
										 |  |  | fn string_slice(arg: &str) {
 | 
					
						
							|  |  |  |     println!("{}", arg);
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | fn string(arg: String) {
 | 
					
						
							|  |  |  |     println!("{}", arg);
 | 
					
						
							| 
									
										
										
										
											2015-09-20 17:31:41 -05:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-11 06:46:42 -06:00
										 |  |  | fn main() {
 | 
					
						
							| 
									
										
										
										
											2020-08-25 09:38:41 -05:00
										 |  |  |     ???("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());
 | 
					
						
							| 
									
										
										
										
											2015-09-20 17:31:41 -05:00
										 |  |  | }
 |