# Replace - 指令碼與圖表函數

將輸入字串內所有出現的指定子字串取代為另一個子字串之後，Replace() 會傳回該字串。此函數不遞迴並會從左至右運作。

語法：

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

傳回的資料類型： 字串

引數：

引數

| 引數 | 描述 |
| --- | --- |
| text | 原始字串。 |
| from\_str | 輸入字串 text 內可能出現一次或多次的字串。 |
| to\_str | 要取代字串 text 內所有出現的 from\_str 的字串。 |

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

#### 範例與結果：

| 範例 | 結果 |
| --- | --- |
| `Replace('abccde','cc','xyz')` | 傳回 'abxyzde' |

## 瞭解更多資訊

* [Replace](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/Replace.htm)