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