Copy as Markdown View as Markdown (opens in new tab) View on GitHub (opens in new tab) Open in... ChatGPT (opens in new tab) Claude (opens in new tab) Perplexity (opens in new tab) mapString mapString(@StreamCapable text: String, mapper: (character: String, index: Number) -> String): String Applies an expression to every character of a string. Introduced in DataWeave version 2.4.0. Parameters Name Description text The string to map. mapper Expression that applies to each character ($) or index ($$) of the text string and returns a string. Example This example redacts sensitive data from a string. Source %dw 2.0 import * from dw::core::Strings output application/json --- { balance: ("\$234" mapString if (isNumeric($)) "~" else $) } Output { "balance": "$~~~" } mapString(@StreamCapable text: Null, mapper: (character: Nothing, index: Nothing) -> Any): Null Helper function that enables mapString to work with a null value. Introduced in DataWeave version 2.4.0.