Contact Us 1-800-596-4880

lines

lines(text: String): Array<String>

Returns an array of lines from a string.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

text

The string to split into lines.

Example

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

Source

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

Output

["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.