This version of the product has reached
End of Life.
collapse
collapse(text: String): Array<String>
Collapses the string into substrings of equal characters.
Each substring contains a single character or identical characters
that are adjacent to one another in the input string. Empty spaces
are treated as characters.
Introduced in DataWeave version 2.4.0.
Parameters
Name
Description
text
The string to collapse.
Example
This example shows how the function collapses characters.
Notice that the empty space (" ") is treated as a character.
Source
%dw 2.0
import collapse from dw::core::Strings
output application/json
---
collapse("a b babb a")
Output
["a", " ", "b", " ", "b", "a", "bb", " ", "a"]
collapse(text: Null): Null
Helper function that enables collapse to work with a null value.