%dw 2.0
import isWhitespace from dw::core::Strings
output application/json
---
{
"a": isWhitespace(null),
"b": isWhitespace(""),
"c": isWhitespace(" "),
"d": isWhitespace("abc"),
"e": isWhitespace("ab2c"),
"f": isWhitespace("ab-c")
}
isWhitespace
isWhitespace(String): Boolean
Checks if the text
contains only whitespace.
Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later.
Example
This example shows how isWhitespace
behaves with different inputs and sizes.