Skip to main content
Module

x/rimbu/typical/str.ts

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
import * as rimbu from "https://deno.land/x/rimbu@0.13.1/typical/str.ts";

Type Aliases

Convenience type to represent the concatenation of two string types.

Convenience type to represent the concatenation of three string types.

Returns the character in the given string at the given Index, or false if the index is out of bounds.

Returns true if the given string contains the given Amount (default 1) of Sub types.

Returns the amount of times the given Sub type is encountered in the given string.

Returns the given string without the first N characters, or an empty string if the string has less characters.

Returns the given string without the first N characters, or false if the string has less characters.

Skips part of the string as long as its parts match Sub.

If the given string does not end with the given End type, returns false. Otherwise, returns a tuple containing the start and the matched end.

Returns a string containing all the elements that match the given Sub type.

Returns a string containing all the elements that do not match the given Sub type.

Returns the first character of the given string, or false if the string is empty.

Returns all but the last character of the given string, or false if the string is empty.

Returns false if the given string is empty, true otherwise.

Returns the last character of the given string, or false if the string if empty.

Returns the length of the given string S.

Returns never if the given string is empty, otherwise the given string.

Returns true if the given string does not contain the given Amount (default 1) of Sub types.

Returns a tuple containing the matched part and the rest of the given string if the string start repeats the given Sub at least N times.

Returns a tuple containing the matched part and the rest of the given string if the string start repeats the given Sub at most N times.

Returns a tuple containing the matched part and the rest of the given string if the string start repeats the given Sub exactly N times.

Replaces, in the given string, all matches with Sub with the given Repl.

Replaces, in the given string, the first match with Sub with the given Repl. Returns never if there was no match.

Replaces, in the given string, the last match with Sub with the given Repl. Returns never if there was no match.

Returns the given string reversed.

Returns false if the given string does not contain the given Middle type, or a 3-tuple containing the start, the matched middle, and the rest.

If the given string does not start with the given Start type, returns false. Otherwise, returns a tuple containing the matched start and the rest.

Returns all but the first character of the given string, or false if the string is empty.

Returns the first N characters of the given string, or the given string if it does not have enough characters.

Returns the first N characters of the given string, or false if the string does not have enough characters.

Returns part of the string as long as its parts match Sub.