%dw 2.0
import lines from dw::core::Strings
output application/json
---
lines("hello world\n\nhere data-weave")
DataWeave
lines
lines(text: String): Array<String>
Returns an array of lines from a string.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The string to split into lines. |
Example
This example divides a string into lines.
An \n
represents a line break.
Source
Output
["hello world", "", "here data-weave"]
Json
lines(text: Null): Null
Helper function that enables lines
to work with a null
value.
Introduced in DataWeave version 2.4.0.