# Replace - script and chart function

Replace() returns a string after replacing all occurrences of a given substring within the input string with another substring. The function is non-recursive and works from left to right.

Syntax:

Replace(text, from\_str, to\_str)

Return data type: string

Arguments:

Replace arguments

| Argument | Description |
| --- | --- |
| text | The original string. |
| from\_str | A string which<br>may occur one or more times within the input string text. |
| to\_str | The string that<br>will replace all occurrences of from\_str within the string text. |

Examples and results:

Examples and results

| Example | Result |
| --- | --- |
| `Replace('abccde','cc','xyz')` | Returns 'abxyzde' |