method str.contains
Whether needle occurs in the text.
Example:
fn main() io {
print("{"hello".contains("ell")} {"hello".contains("z")}")
}Output
true false
True when needle occurs in the string.
Example:
fn main() io {
print("{"hello".contains("ell")} {"hello".contains("z")}")
}Output
true false
pub(api) fn contains(needle: str) -> boolComplexity. O(n * m) worst case in the lengths of text and needle.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
needle | str |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/text.oxl:166