Contact Us 1-800-596-4880

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

text

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

%dw 2.0
import words from dw::core::Strings
output application/json
---
words("hello world\nhere\t\t\tdata-weave")

Output

["hello", "world", "here", "data-weave"]

words(text: Null): Null

Helper function that enables words to work with a null value.

Introduced in DataWeave version 2.4.0.