---
schema_version: "1"
id: 9f86394415c7f057debd85209a2fef72d976fc2434da50b8b2f744be071efa21
title: lines
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-strings-functions-lines.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-lines
source_site: docs.mulesoft.com
content_type: documentation
content_hash: bf7197fd08ed1134a0dc7d585456974b9ac0093cc7a32ee400b226e8f9f9f715
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# lines

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

## lines(text: String): Array<String>

Returns an array of lines from a string.

_Introduced in DataWeave version 2.4.0._

### 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 string to split into lines.</p></td></tr></tbody></table>

### Example

This example divides a string into lines. An `\n` represents a line break.

#### Source

```DataWeave
%dw 2.0
import lines from dw::core::Strings
output application/json
---
lines("hello world\n\nhere   data-weave")
```

#### Output

```Json
["hello world", "", "here   data-weave"]
```

## lines(text: Null): Null

Helper function that enables `lines` to work with a `null` value.

_Introduced in DataWeave version 2.4.0._
