OxL Reference

method str.replaceFirst

Replaces only the first occurrence.

Example:

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

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:683

See also