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