---
schema_version: "1"
id: 640295de59d3bf61fca3f75ff7c1862299a9d03e0e180e0e150367eb5bd326b4
title: repeat
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-strings-functions-repeat.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-strings-functions-repeat
source_site: docs.mulesoft.com
content_type: documentation
content_hash: df0bd912fc403aa084310dddb7bb0967d9544d17d477c7fe23dea93b2072ad9d
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# repeat

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## repeat(String, Number): String

Repeats a `text` the number of specified `times`.

_Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The input string.</p></td></tr><tr><td><p><code>times</code></p></td><td><p>Number of times to repeat char. Negative is treated as zero.</p></td></tr></tbody></table>

### Example

This example shows how `repeat` behaves with different inputs and sizes.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "a": repeat("e", 0),
  "b": repeat("e", 3),
  "c": repeat("e", -2)
}
```

#### Output

```JSON
{
  "a": "",
  "b": "eee",
  "c": ""
}
```
