String Functions
Modified on Thu, 17 Aug 2023
8 minutes read
This document is a draft version and subject to further review and revision. Please refrain from distributing or relying on its contents as final.
UI Element | Description |
---|---|
capitalize | Convert the first character of text to upper case and the remaining to lower case |
deburr | Deburr string by converting Latin-1 supplementary letters to basic Latin letters and removing combining diacritical marks |
ends with | Check if a string ends with the given target string |
escapeRegExp | Escape the RegExp special characters in the text |
lowerCase | Convert string, as space-separated words, to lowercase |
pad | Pad string on the left and right sides if it's shorter than the length. Padding characters are truncated if they can't be evenly divided by the length |
padEnd | Pad string on the right side if it's shorter than the length. Padding characters are truncated if they exceed the length |
padStart | Pad string on the left side if it's shorter than length. Padding characters are truncated if they exceed length |
repeat | Repeat the given string n times |
replace | Replace matches for pattern in string with replacement |
snakeCase | Convert string to snake case |
split | Split string by separator |
startsWith | Check if string starts with the given target string |
toLower | Convert string, as a whole, to lower case |
toUpper | Convert string, as a whole, to upper case |
trim | Remove leading and trailing whitespace or specified characters from the string |
trimEnd | Remove trailing whitespace or specified characters from a string |
trimStart | Remove leading whitespace or specified characters from string |
truncate | Truncate string if it's longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to ... |
words | Split string into an array of its words |
toString | Convert `value` to a string. An empty string is returned for `null` and `undefined` values. The sign of `-0` is preserved. |
startsWith | Check if string starts with the given target string |
substrings | Extract a substring from the given string by using the index values. |
regexReplace | Replace matches for `pattern` in `input` string with `replacement`. |
regexSearch | Return first index of match for `pattern` in `input` string. Return `-1` if there is no match. |
stringIndexOf | Return the index of the first occurrence of the specified substring at a position greater than or equal to position, which defaults to 0. |
jsonStringify | Convert the input value to a JSON string |
getUrlQueryParameter | Return the first value associated with the given search parameter in a URL. |
left | Return a specified number of characters from the beginning of a string |
removeCharacters | Remove a list of characters from a string |
Convert the JSON string value to an object | |
removeNonAlphaNumericCharacters | Remove non-alphanumeric characters (excluding letters and digits) from a string |
removeNonAlphaNumericCharactersFromEdges | Remove non-alphanumeric characters (excluding letters and digits) from the edges of a string |
removeNonNumericCharacters | Remove non-numeric characters (excluding digits) from a string |
replaceMultipleCharacters | Replace multiple characters in a string according to a given mapping |
right | Return a specified number of characters from the end of a string |
stringLength | Calculate the length of a string |
textAfter | Extract the text after a specified substring in a string |
textBefore | Extract the text before a specified substring in a string |
toSingleSpace | Convert multiple spaces to a single space for a string |
toTitleCase | Convert a string to proper case (title case) |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article