std-method
str::contains
Test whether a supported search pattern occurs in the text, such as a char or &str. Matching is not regex or case-insensitive by default. Expected stdout (not executed): true false Common mistake: Assuming a pattern string is a regular expression.
Formal Syntax & Structure
rust syntaxrust
fn contains<P: Pattern>(&self, pat: P) -> boolWorking Example
Example Snippetrust
fn main() { let label = "Order: ready"; println!("{} {}", label.contains("ready"), label.contains("READY"));}