OxL Reference

method str.replace

The text with every occurrence of from replaced by to.

Example:

oxl✓ checked in CI
fn main() io {
  print("a-b-c".replace("-", "+"))
}
Output
a+b+c

Replaces every occurrence of from with to.

Example:

oxl✓ checked in CI
fn main() io {
  print("a-b-c".replace("-", "+"))
}
Output
a+b+c
pub(api) fn replace(from: str, to: str) -> str

Complexity. O(n).

Since. 1.0.0-beta

Parameters

NameType
fromstr
tostr

Returns

str

Effects

none declared (pure unless the body says otherwise)

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

See also