Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.02 KB

dw-strings-functions-iswhitespace.adoc

File metadata and controls

66 lines (48 loc) · 1.02 KB

isWhitespace

isWhitespace(text: String): Boolean

Checks if the text contains only whitespace.

Introduced in DataWeave version 2.2.0.

Parameters

Name Description

text

The input string.

Example

This example shows how isWhitespace behaves with different inputs and sizes.

Source

%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")
}

Output

{
  "a": false,
  "b": true,
  "c": true,
  "d": false,
  "e": false,
  "f": false
}

isWhitespace(text: Null): Boolean

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

Introduced in DataWeave version 2.2.0.