Contact Us 1-800-596-4880

everyCharacter

everyCharacter(text: String, condition: (character: String) -> Boolean): Boolean

Checks whether a condition is valid for every character in a string.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

text

The string to check.

condition

Expression that iterates through the characters in the string that it checks and returns a Boolean value.

Example

This example determines whether a string is composed of only digits and spaces.

Source

%dw 2.0
import * from dw::core::Strings
output application/json
---
"12 34  56" everyCharacter $ == " " or isNumeric($)

Output

true

everyCharacter(text: Null, condition: (character: Nothing) -> Any): true

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

Introduced in DataWeave version 2.4.0.