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

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