String matching: Difference between revisions

Content added Content deleted
Line 2,787: Line 2,787:
<lang rust>
<lang rust>
fn main(){
fn main(){
let hello = String::from("Hello word");
let hello = String::from("Hello world");
println!(" Start with \"he\" {} \n Ends with \"rd\" {}\n Contains \"wi\" {}",
println!(" Start with \"he\" {} \n Ends with \"rd\" {}\n Contains \"wi\" {}",
hello.starts_with("He"),
hello.starts_with("He"),
hello.ends_with("rd"),
hello.ends_with("ld"),
hello.contains("wi"));
hello.contains("wi"));
}</lang>
}</lang>
Line 2,796: Line 2,796:
{{out}}
{{out}}
Start with "he" true
Start with "he" true
Ends with "rd" true
Ends with "ld" true
Contains "wi" false
Contains "wi" false