# Repeat - 指令碼與圖表函數

Repeat() 會形成一個字串，包含的輸入字串重複第二個引數所定義的次數。

語法：

Repeat(text[, repeat\_count])

傳回的資料類型： 字串

引數：

引數

| 引數 | 描述 |
| --- | --- |
| text | 原始字串。 |
| repeat\_count | 定義字串 text 中要在輸出字串中重複的字元的次數。 |

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

#### 範例：圖表運算式

| 範例 | 結果 |
| --- | --- |
| `Repeat( ' * ', rating )` when rating = 4 | 傳回 '\*\*\*\*' |

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

#### 範例：載入指令碼

```
T1:
Load *,
repeat(String,2) as Repeat;
Load * inline [
String
hello world!
hOw aRe you? ]; 
```

結果

| 字串 | 重複 |
| --- | --- |
| hello world! | hello world!hello world! |
| hOw aRe you? | hOw aRe you?hOw aRe you? |