remove

remove(text: String, toRemove: String): String

Removes all occurrences of a specified pattern from a string.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

text

The text to remove from.

toRemove

The pattern to remove.

Example

This example shows how the remove can be used to remove some unwanted properties.

Source

%dw 2.0
import remove from dw::core::Strings
output application/json
---
"lazyness purity state higher-order stateful" remove "state"

Output

"lazyness purity  higher-order ful"

remove(text: Null, toRemove: Any): Null

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

Introduced in DataWeave version 2.4.0.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub