Last active
March 18, 2020 18:02
-
-
Save NebulaFox/e6baa2bc937ab0c5f293c09c1fdd95cb to your computer and use it in GitHub Desktop.
Vec contains problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let array_str = ["a", "b", "c"]; | |
let array_string = ["a".to_string(), "b".to_string(), "c".to_string()]; | |
let value_str = "b"; | |
let value_string = String::from(value_str); | |
let result_str = array_str.contains(&value_string); | |
let result_string = array_string.contains(&value_str); | |
let result_literal = array_string.contains("b"); | |
println!( | |
"result: {} {} {}", | |
result_str, result_string, result_literal | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment