method str.replace
The text with every occurrence of from replaced by to.
Example:
fn main() io {
print("a-b-c".replace("-", "+"))
}Output
a+b+c
Replaces every occurrence of from with to.
Example:
fn main() io {
print("a-b-c".replace("-", "+"))
}Output
a+b+c
pub(api) fn replace(from: str, to: str) -> strComplexity. O(n).
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
from | str |
to | str |
Returns
str
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/text.oxl:553