Functions to read and manipulate string variables.
Creates a new random GUID as 36 lower-case characters with hyphens, for example 3f2504e0-4f89-41d3-9a0c-0305e82c3301. Available as guid()…
Creates a new random GUID in a short, URL-safe Base64 format: 22 characters from A–Z, a–z, 0–9, - and _. Only available as docly.guid2().
Returns the MD5 hash of the text as 32 upper-case hexadecimal characters. The text is encoded as UTF-8, numbers are converted the…
Returns the SHA-256 hash of the text as 64 upper-case hexadecimal characters. The text is encoded as UTF-8, numbers are converted the…
Template literals are strings that can cross multiple lines and easily bind in values through single JS expressions inside the string. The…
Converts a byte array to a string using the specified encoding.
Converts a string into bytes using the specified encoding.
Converts multi-line plain text to HTML: encodes HTML characters (like htmlEncode), turns line breaks into <br /> and URLs into links. Line…
Encode a filename by replacing characters not allowed in filenames with their ASCII code representations. Reverse function of…
Decode an encoded filename string by replacing ASCII code representations with symbols (not allowed in filenames). Reverse function of…
Encodes a URI by replacing certain characters by escape sequences representing the UTF-8 encoding of the characters.
Encodes a URI component by replacing certain characters with escape sequences representing the UTF-8 encoding. Unlike encodeURI, it also…
The HtmlAttributeEncode method encodes characters appropriate for insertion into an HTML attribute value.
Encodes <, >, &, " and ' as HTML entities, so text can be placed safely in HTML element content. Several arguments are encoded and joined.…
Removes empty lines, and lines that contain only white space, from a string.
Returns this string joined with the arguments. The input strings are not changed. Values are converted with .NET formatting, so true…
The includes() method returns true if a string contains a specified string.
The substring() method returns a part of the string between the start and end indexes, or to the end of the string.
Searches the entire calling string, and returns the index of the first occurrence of the specified substring.
Searches for the last occurrence of a substring within a string.
Returns the Unicode Normalization Form of the string, allowing comparison of strings that may use different code-point sequences for the…
Repeats a string a specified number times and returns the new value.
Returns a new string where the FIRST occurrence of find is replaced. To replace every occurrence, use replaceAll() or a regular expression…
Splits a single string into an array of strings based on the specified separator. In template mode there is also an older global helper…
Searches the end of the string, and returns a boolean that is True if the string ends with this text otherwise False.
Searches the start of the string, and returns a boolean that is True if the string starts with this text otherwise False.
Removes white space — spaces, tabs and line breaks — from both ends of a string. trimStart() and trimEnd() remove it from one end only.…
Removes all tags from a string
URL-encodes text the way HTML forms do: a space becomes + and other unsafe characters become %xx. Use encodeURIComponent() when you need…
Converts Markdown-formatted text to HTML.
Returns the part of the string from start up to (not including) end. Negative values count from the end of the string. Unlike substring(),…
Pads the start of the string with another string until it reaches the given length — typically for leading zeros. padEnd() pads at the end…
Returns a new string where every occurrence of the search text is replaced. The original string is not changed. With a regular expression,…
Searches the string with a regular expression. If you pass text instead of a regular expression, HashJS searches for that exact text —…
Returns the string converted to lower case. Letters such as Æ, Ø and Å are converted too. toLocaleLowerCase() gives the same result.
Returns the string converted to upper case. Letters such as æ, ø and å are converted too. toLocaleUpperCase() gives the same result.