method str.replace
The text with every occurrence of from replaced by to.
Example:
fn main() io {
print("a-b-c".replace("-", "+"))
}Вывод
a+b+c
Replaces every occurrence of from with to.
Example:
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
Параметры
| Имя | Тип |
|---|---|
from | str |
to | str |
Возвращает
str
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/text.oxl:553