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

# 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._
