---
schema_version: "1"
id: 8a83669b0d415f726c5c94fe2b0aae6ae3e9f14cdd09f9a1a40e972b222b776a
title: Strings (dw::core::Strings)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-strings.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-strings
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 61cfbed0aef23911e6f2e4ac27ea48f6d9ac208b0951e05a1c528dd231a92de0
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# Strings (dw::core::Strings)

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This module contains helper functions for working with strings.

To use this module, you must import it to your DataWeave code, for example, by adding the line
`import * from dw::core::Strings` to the header of your DataWeave script.

## Functions

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-appendifmissing">appendIfMissing</a></p></td><td><p>Appends the <code>suffix</code> to the end of the <code>text</code> if the <code>text</code> does not already ends with the <code>suffix</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-camelize">camelize</a></p></td><td><p>Returns a string in camel case based on underscores in the string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-capitalize">capitalize</a></p></td><td><p>Capitalizes the first letter of each word in a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-charcode">charCode</a></p></td><td><p>Returns the Unicode for the first character in an input string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-charcodeat">charCodeAt</a></p></td><td><p>Returns the Unicode for a character at the specified index.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-collapse">collapse</a></p></td><td><p>Collapses the string into substrings of equal characters.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-countcharactersby">countCharactersBy</a></p></td><td><p>Counts the number of times an expression that iterates through each character in a string returns <code>true</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-countmatches">countMatches</a></p></td><td><p>Counts the number of matches in a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-dasherize">dasherize</a></p></td><td><p>Replaces spaces, underscores, and camel-casing in a string with dashes (hyphens).</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-everycharacter">everyCharacter</a></p></td><td><p>Checks whether a condition is valid for <em>every</em> character in a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-first">first</a></p></td><td><p>Returns characters from the beginning of a string to the specified number of characters in the string, for example, the first two characters of a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-fromcharcode">fromCharCode</a></p></td><td><p>Returns a character that matches the specified Unicode.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-hammingdistance">hammingDistance</a></p></td><td><p>Returns the Hamming distance between two strings.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-isalpha">isAlpha</a></p></td><td><p>Checks if the <code>text</code> contains only Unicode digits. A decimal point is not a Unicode digit and returns <code>false</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-isalphanumeric">isAlphanumeric</a></p></td><td><p>Checks if the <code>text</code> contains only Unicode letters or digits.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-islowercase">isLowerCase</a></p></td><td><p>Checks if the <code>text</code> contains only lowercase characters.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-isnumeric">isNumeric</a></p></td><td><p>Checks if the <code>text</code> contains only Unicode digits.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-isuppercase">isUpperCase</a></p></td><td><p>Checks if the <code>text</code> contains only uppercase characters.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-iswhitespace">isWhitespace</a></p></td><td><p>Checks if the <code>text</code> contains only whitespace.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-last">last</a></p></td><td><p>Returns characters from the end of string to a specified number of characters, for example, the last two characters of a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-leftpad">leftPad</a></p></td><td><p>The specified <code>text</code> is <em>left</em>-padded to the <code>size</code> using the <code>padText</code>. By default <code>padText</code> is <code>" "</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-levenshteindistance">levenshteinDistance</a></p></td><td><p>Returns the Levenshtein distance (or edit distance) between two strings.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-lines">lines</a></p></td><td><p>Returns an array of lines from a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-mapstring">mapString</a></p></td><td><p>Applies an expression to every character of a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-ordinalize">ordinalize</a></p></td><td><p>Returns a number as an ordinal, such as <code>1st</code> or <code>2nd</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-pluralize">pluralize</a></p></td><td><p>Pluralizes a singular string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-prependifmissing">prependIfMissing</a></p></td><td><p>Prepends the <code>prefix</code> to the beginning of the string if the <code>text</code> does not already start with that prefix.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-remove">remove</a></p></td><td><p>Removes all occurrences of a specified pattern from a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-repeat">repeat</a></p></td><td><p>Repeats a <code>text</code> the number of specified <code>times</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-replaceall">replaceAll</a></p></td><td><p>Replaces all substrings that match a literal search string with a specified replacement string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-reverse">reverse</a></p></td><td><p>Reverses sequence of characters in a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-rightpad">rightPad</a></p></td><td><p>The specified <code>text</code> is <em>right</em>-padded to the <code>size</code> using the <code>padText</code>. By default <code>padText</code> is <code>" "</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-singularize">singularize</a></p></td><td><p>Converts a plural string to its singular form.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-somecharacter">someCharacter</a></p></td><td><p>Checks whether a condition is valid for at least one of the characters or blank spaces in a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substring">substring</a></p></td><td><p>Returns a substring that spans from the character at the specified <code>from</code> index to the last character before the <code>until</code> index.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafter">substringAfter</a></p></td><td><p>Gets the substring after the first occurrence of a separator. The separator is not returned.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringafterlast">substringAfterLast</a></p></td><td><p>Gets the substring after the last occurrence of a separator. The separator is not returned.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbefore">substringBefore</a></p></td><td><p>Gets the substring before the first occurrence of a separator. The separator is not returned.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringbeforelast">substringBeforeLast</a></p></td><td><p>Gets the substring before the last occurrence of a separator. The separator is not returned.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringby">substringBy</a></p></td><td><p>Splits a string at each character where the <code>predicate</code> expression returns <code>true</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-substringevery">substringEvery</a></p></td><td><p>Splits a string into an array of substrings equal to a specified length.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-underscore">underscore</a></p></td><td><p>Replaces hyphens, spaces, and camel-casing in a string with underscores.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-unwrap">unwrap</a></p></td><td><p>Unwraps a given <code>text</code> from a <code>wrapper</code> text.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-withmaxsize">withMaxSize</a></p></td><td><p>Checks that the string length is no larger than the specified <code>maxLength</code>. If the string’s length is larger than the <code>maxLength</code>, the function cuts characters from left to right, until the string length meets the length limit.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-words">words</a></p></td><td><p>Returns an array of words from a string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-wrapifmissing">wrapIfMissing</a></p></td><td><p>Wraps <code>text</code> with <code>wrapper</code> if that <code>wrapper</code> is missing from the start or end of the given string.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/latest/dw-strings-functions-wrapwith">wrapWith</a></p></td><td><p>Wraps the specified <code>text</code> with the given <code>wrapper</code>.</p></td></tr></tbody></table>
