OxL Справочник OxL
РусскийEnglish

method str.replace

The text with every occurrence of from replaced by to.

Example:

oxl✓ проверяется в CI
fn main() io {
  print("a-b-c".replace("-", "+"))
}
Вывод
a+b+c

Replaces every occurrence of from with to.

Example:

oxl✓ проверяется в CI
fn main() io {
  print("a-b-c".replace("-", "+"))
}
Вывод
a+b+c
pub(api) fn replace(from: str, to: str) -> str

Сложность. O(n).

С версии. 1.0.0-beta

Параметры

ИмяТип
fromstr
tostr

Возвращает

str

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/text.oxl:553

См. также