Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/string/index.ts

A JavaScript extension package for building strong and modern applications.
Latest
import * as ayonliJsext from "https://deno.land/x/ayonli_jsext@v0.9.72/string/index.ts";

Functions for dealing with strings.

Functions

Returns the byte length of the string.

f
bytes
deprecated

Returns the bytes of the given string.

Capitalizes the string, if all is true, all words are capitalized, otherwise only the first word will be capitalized.

Returns the characters of the string (emojis are supported).

Breaks the string into smaller chunks according to the given length.

Compares two strings, returns -1 if a < b, 0 if a === b and 1 if a > b.

Counts the occurrence of the sub-string in the string.

Removes extra indentation from the string.

Replaces the spaces between non-empty characters of the string with hyphens (-).

Checks if all characters in the string are within the ASCII range.

Checks if all characters in the string are emojis.

Splits the string into lines by \n or \r\n.

Returns a random string restricted by length (character-wise).

Removes the given suffix of the string if present.

Removes the given prefix of the string if present.

Removes leading and trailing spaces or custom characters of the string.

Removes trailing spaces or custom characters of the string.

Removes leading spaces or custom characters of the string.

Truncates the string to the given length (including the ending ...).

Extracts words (in latin characters) from the string.