OxL Reference

method str.count

Number of non-overlapping occurrences of needle (0 for an empty needle).

Example:

oxl✓ checked in CI
fn main() io {
  print("{"banana".count("an")}")
}
Output
2
pub(api) fn count(needle: str) -> usize

Since. 1.0.0-beta

Parameters

NameType
needlestr

Returns

usize

Effects

none declared (pure unless the body says otherwise)

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

See also