# 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:

Arguments

| Argument | Description |
| --- | --- |
| text | The original string. |
| from\_str | A string that<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. |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/Replace.htm)

#### Examples and results:

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

## Learn more

* [Replace](https://help.qlik.com/en-US/sense/November2024/Subsystems/Hub/Content/Sense_Hub/Scripting/Replace.htm)