/** * Creates a `RegExp` using a string template. Supports flags. * * @example * * ```ts * const regex = re`/abc/g` * ``` */ export declare function re(strings: TemplateStringsArray, ...keys: any[]): RegExp; /** * Helper for checking if a `Set`, `Array`, or `string` contains another * `string`. Handles undefined or null inputs by returning false. * * @param value - The value to check for. * @param container - The container of strings (or another string). */ export declare function includes(value: string | undefined | null, container: Set | string[] | string | undefined | null): boolean; /** Takes a string and escapes any `RegExp` sensitive characters. */ export declare function escapeRegExp(str: string): string; /** * Replaces a range inside of a string with a substitute. * * @param str - The string which should have a range inside of it replaced. * @param from - The start of the replacement range. * @param to - The end of the replacement range. * @param sub - The replacement/substitute string. */ export declare function replaceRange(str: string, from: number, to: number, sub: string): string; /** * Uppercases a string. * * @param str - The string to uppercase. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function uppercase(str: string, locale?: string | string[]): string; /** * Lowercases a string. * * @param str - The string to lowercase. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function lowercase(str: string, locale?: string | string[]): string; /** * Titlecases a string. * * @param str - The string to titlecase. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function titlecase(str: string, locale?: string | string[]): string; /** * Determines if a string is titlecased. * * @param str - The string to check. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function isTitlecased(str: string, locale?: string | string[]): boolean; /** * Determines if a string is completely uppercased. * * @param str - The string to check. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function isUppercased(str: string, locale?: string | string[]): boolean; /** * Determines if a string is completely lowercased. * * @param str - The string to check. * @param locale - Uses a locale, or a list of locales, case mapping if * provided. This usually won't be needed, as JS tries to account for * non-ASCII/Latin text when handling casing. */ export declare function isLowercased(str: string, locale?: string | string[]): boolean; /** * Reverses a string. * * @param str - The string to reverse. */ export declare function reverse(str: string): string; /** Splits a line by its whitespace. */ export declare function split(line: string): string[]; /** * Returns true if the given string 3 characters and all characters are the same. * * @param s - The string to check. */ export declare function isTriplet(s: string): boolean; /** * Returns a new set containing all intersecting elements between two sets. * * @param a - The first set. * @param b - The second set. */ export declare function intersect(a: Set, b: Set): Set; export declare function concat(a: string, b: Iterable): string; export declare function concat(a: Set, b: Iterable): Set; export declare function concat(a: T[], b: Iterable): T[]; export declare function product(...iterables: Iterable[]): Generator; /** Returns true if the given iterator yields literally anything. */ export declare function any(gen: Iterable): boolean; /** * Limits an iterator to the specified count. * * @param gen - The iterator to limit. param n - The number of elements to limit to. */ export declare function limit(gen: Iterable, n: number): Iterable; /** * Returns the number of characters common between two strings, in both * type and position. */ export declare function commonCharacters(s1: string, s2: string): number; /** Returns the amount of characters in common between the left-sides of two strings. */ export declare function leftCommonSubstring(s1: string, s2: string): number; /** * Returns the number of ngrams of `s1` are in `s2`. Higher is better. * * @param max - The `n` in `ngram`. * @param s1 - String to compare against `s2`. * @param s2 - String to compare against `s1`. * @param weighted - Reduce score depending on number ngrams *not contained* in `s2`. * @param longerIsWorse - Reduce score when `s2` is longer than `s1`. * @param anyMismatch - Reduce score if the strings differ in length at all. */ export declare function ngram(max: number, s1: string, s2: string, weighted?: boolean, anyMismatch?: boolean, longerIsWorse?: boolean): number; /** Length of the "longest common subsequence" in two strings. */ export declare function lcslen(a: string, b: string): number;