OxL Reference

method str.contains

Whether needle occurs in the text.

Example:

oxl✓ checked in CI
fn main() io {
  print("{"hello".contains("ell")} {"hello".contains("z")}")
}
Output
true false

True when needle occurs in the string.

Example:

oxl✓ checked in CI
fn main() io {
  print("{"hello".contains("ell")} {"hello".contains("z")}")
}
Output
true false
pub(api) fn contains(needle: str) -> bool

Complexity. O(n * m) worst case in the lengths of text and needle.

Since. 1.0.0-beta

Parameters

NameType
needlestr

Returns

bool

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/text.oxl:166

See also