Skip to content

text

Module

Contains functions and filters to work with texts.

Exports

asLowerCase Makes all characters in text lower case
asNumber Deprecated — use the conversion operator to turn a text into a number instead. Returns nothing if the text can't be parsed.
asUpperCase Makes all characters in text upper case
asUrlDecoded Decodes a percent-encoded URL query parameter value into text (RFC 3986).
asUrlEncoded Percent-encodes a text value so it can safely be used as a URL query parameter value (RFC 3986).
decode Decodes text to binary data using keywords like base64, base64Url, hex, or utf8/text.
encode Encodes binary data to a text format using keywords like base64, base64Url, hex, or utf8/text.
explode Splits a text into an iterator of texts based on a given separator pattern
extract Extracts regex matches and capture groups from a text.
format Substitutes named placeholders in a text template with values from a record.
formatDate Formats a date for display in the given BCP-47 locale, using the locale's own default date pattern.
formatInstant Formats an instant for display in the given BCP-47 locale, using the locale's own default date-and-time pattern.
formatMoney Formats an amount with an ISO 4217 currency code for display in the given BCP-47 locale.
formatNumber Formats a number for display in the given BCP-47 locale, using the locale's grouping and decimal separators.
implode Joins an iterator of texts into a single text using a separator
indexOf Returns the index of the first occurrence of the pattern in a texgt
lastIndexOf Returns the index of the last occurrence of the pattern in a texgt
length Returns the number of characters in a text value.
removeDiacritics Removes diacritic marks (accents) from a text value, replacing accented characters with their base equivalents. Optionally preserves specific characters using the except keyword.
replace Replaces matching substring in a text.
slice Extracts a substring from an input text.
trim Removes leading and trailing whitespace and tab characters from a text value.