Strings (dw::core::Strings) | MuleSoft Documentation
# Strings (dw::core::Strings)
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
Name | Description  
---|---  
| Appends the `suffix` to the end of the `text` if the `text` does not already ends with the `suffix`.  
Returns a string in camel case based on underscores in the string.  
Capitalizes the first letter of each word in a string.  
Returns the Unicode for the first character in an input string.  
Returns the Unicode for a character at the specified index.  
Collapses the string into substrings of equal characters.  
| Counts the number of times an expression that iterates through each character in a string returns `true`.  
| Counts the number of matches in a string.  
Replaces spaces, underscores, and camel-casing in a string with dashes (hyphens).  
| Checks whether a condition is valid for _every_ character in a string.  
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.  
| Returns a character that matches the specified Unicode.  
| Returns the Hamming distance between two strings.  
Checks if the `text` contains only Unicode digits. A decimal point is not a Unicode digit and returns `false`.  
| Checks if the `text` contains only Unicode letters or digits.  
Checks if the `text` contains only lowercase characters.  
Checks if the `text` contains only Unicode digits.  
Checks if the `text` contains only uppercase characters.  
| Checks if the `text` contains only whitespace.  
Returns characters from the end of string to a specified number of characters, for example, the last two characters of a string.  
The specified `text` is _left_ -padded to the `size` using the `padText`. By default `padText` is `" "`.  
| Returns the Levenshtein distance (or edit distance) between two strings.  
Returns an array of lines from a string.  
Applies an expression to every character of a string.  
Returns a number as an ordinal, such as `1st` or `2nd`.  
Pluralizes a singular string.  
| Prepends the `prefix` to the beginning of the string if the `text` does not already start with that prefix.  
Removes all occurrences of a specified pattern from a string.  
Repeats a `text` the number of specified `times`.  
Replaces all substrings that match a literal search string with a specified replacement string.  
Reverses sequence of characters in a string.  
The specified `text` is _right_ -padded to the `size` using the `padText`. By default `padText` is `" "`.  
Converts a plural string to its singular form.  
| Checks whether a condition is valid for at least one of the characters or blank spaces in a string.  
Returns a substring that spans from the character at the specified `from` index to the last character before the `until` index.  
| Gets the substring after the first occurrence of a separator. The separator is not returned.  
| Gets the substring after the last occurrence of a separator. The separator is not returned.  
| Gets the substring before the first occurrence of a separator. The separator is not returned.  
| Gets the substring before the last occurrence of a separator. The separator is not returned.  
Splits a string at each character where the `predicate` expression returns `true`.  
| Splits a string into an array of substrings equal to a specified length.  
Replaces hyphens, spaces, and camel-casing in a string with underscores.  
Unwraps a given `text` from a `wrapper` text.  
Checks that the string length is no larger than the specified `maxLength`. If the string’s length is larger than the `maxLength`, the function cuts characters from left to right, until the string length meets the length limit.  
Returns an array of words from a string.  
| Wraps `text` with `wrapper` if that `wrapper` is missing from the start or end of the given string.  
Wraps the specified `text` with the given `wrapper`.