String.replace_all
String.replace_all
Function
Replaces all matches in a string.
Syntax
string.replace_all(from, to)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| from | String or Regex | Yes | None | What to replace. |
| to | String | No | Empty string | The content after replacement. |
Return value
| Type | Description |
|---|---|
| String | The new string after replacement. |
Code Example
result = 'a-a-a'.replace_all('a', 'b') // Output: b-b-b print result
Notes
- Unlike replace, replace_all replaces all matches.