/** * Defines an abstract class with string utilities. */ export declare abstract class Strings { /** * Contains an empty string. */ static readonly EMPTY: string; /** * Gets the index returned when some sequence is not found in some * string. * * @private */ private static readonly NOT_FOUND; /** * @constructor * * @private */ private constructor(); /** * Abbreviates the specified string to the given number of characters. * The rest of characters are replaced by some user-defined marker string * or the default marker i. e. ellipsis "...". * * **Usage Examples:** * ```typescript * Strings.abbreviate("", 2); // "" * Strings.abbreviate("a", 1); // "a" * Strings.abbreviate("abc", 2); // "ab..." * Strings.abbreviate("caterpillar", 3); // "cat..." * ``` * * @param {String} str Contains some string. * @param {Number} maxLength Contains the maximal number of characters to * show from the specified string. * @param {String} marker Contains the abbreviation marker. Defaults to * ellipsis `"..."`. * @return {String} the abbreviated string. */ static abbreviate(str: string, maxLength: number, marker?: string): string; /** * Appends the specified suffix to the given string if the given string * doesn't end with it. * * **Usage Examples:** * ```typescript * Strings.appendIfMissing("", ""); // "" * Strings.appendIfMissing("abc", "def"); // "abcdef" * Strings.appendIfMissing("abcdef", "DeF", true); // "abcdef" * ``` * * @param {String} str Contains some string. * @param {String} suffix Contains the string suffix to be appended to the * string if it is missing at the end of it. * @param {Boolean} ignoreCase Contains whether to ignore string case * sensitivity. Defaults to `false`. * @return {String} a string. */ static appendIfMissing(str: string, suffix: string, ignoreCase?: boolean): string; /** * Removes a newline from the end of the specified string if there * is such one. * * **Usage Examples:** * ```typescript * Strings.chomp(''); // "" * Strings.chomp('\n'); // "" * Strings.chomp('abc \r'); // "abc " * Strings.chomp('abc\r\n'); // "abc" * ``` * * @param {String} str Contains some string. * @return {String} the chomped string. */ static chomp(str: string): string; /** * Removes the last character from the specified string. * * **Usage Examples:** * ```typescript * Strings.chop(''); // "" * Strings.chop('\n\r'); // "\n" * Strings.chop('abc \r'); // "abc " * Strings.chop('Germany'); // "German" * ``` * * @param {String} str Contains some string. * @return {String} the string without its last character. */ static chop(str: string): string; /** * Compares two strings. * * @param {String} a Contains some string. * @param {String} b Contains some other string. * @return {Number} * * `-1` if `a` is smaller than `b`. * * `0` if `a` equals `b`. * * `1` if `a` is greater than `b`. */ static compare(a: string, b: string): number; /** * Compares two strings by ignoring case sensitivity. * * @param {String} a Contains some string. * @param {String} b Contains some other string. * @return {Number} * * `-1` if `a` is smaller than `b` (case-insensitive). * * `0` if `a` equals `b` (case-insensitive). * * `1` if `a` is greater than `b` (case-insensitive). */ static compareIgnoreCase(a: string, b: string): number; /** * Contains whether the specified string contains the given substring. * * **Usage Examples:** * ```typescript * Strings.contains("", ""); // true * Strings.contains(" ", ""); // true * Strings.contains("abc", "bc"); // true * Strings.contains("abc", "BC"); // false * Strings.contains("aBc", "bC", true); // true * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some string substring. * @param {Boolean} ignoreCase Contains whether to ignore case sensitivity. * Defaults to `false`. * @return {Boolean} whether the specified string contains the specified * substring. */ static contains(str: string, substring: string, ignoreCase?: boolean): boolean; /** * Checks whether the specified string contains either of the given * substrings. * * **Usage Examples:** * ```typescript * Strings.containsAny(""); // false * Strings.containsAny("", ""); // true * Strings.containsAny("ab", "cd", "ab", "ef"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} whether the given string contains either of the * given substrings. */ static containsAny(str: string, ...substrings: string[]): boolean; /** * Checks whether the specified string contains the specified substring by * ignoring case sensitivity. * * **Usage Examples:** * ```typescript * Strings.containsIgnoreCase("", ""); // true * Strings.containsIgnoreCase("\n\n", ""); // true * Strings.containsIgnoreCase("abc def", "EF"); // true * Strings.containsIgnoreCase("abc", "de"); // false * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {Boolean} whether the specified string contains the specified * substring by ignoring case sensitivity. */ static containsIgnoreCase(str: string, substring: string): boolean; /** * Checks whether the specified string contains none of the specified * substrings. * * **Usage Examples:** * ```typescript * Strings.containsNone("abc"); // true * Strings.containsNone("", "de", "bc"); // true * Strings.containsNone("abc", "de", "bc"); // false * Strings.containsNone("abc", "de", "fg"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} whether the specified string contains none of the given * substrings. */ static containsNone(str: string, ...substrings: string[]): boolean; /** * Gets the number of times the specified substring appears in the * specified string. * * **Usage Examples:** * ```typescript * Strings.countMatches("", ""); // 0 * Strings.countMatches("", "ho"); // 0 * Strings.countMatches("ho", ""); // 0 * Strings.countMatches("ho ho ho", "ho"); // 3 * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {Number} the number of times the specified substring appears * in the specified string. */ static countMatches(str: string, substring: string): number; /** * Decapitalizes the specified string if it begins with a capital letter. * * **Usage Examples:** * ```typescript * Strings.decapitalize(""); // "" * Strings.decapitalize("\n"); // "\n" * Strings.decapitalize("Abc"); // "abc" * Strings.decapitalize("ABC"); // "aBC" * ``` * * @param {String} str Contains some string. * @return {String} the decapitalized string. */ static decapitalize(str: string): string; /** * Decodes a string encoded using Base64. * * **Usage Examples:** * ```typescript * Strings.decode("27Hbstuz"); // "۱۲۳" * Strings.decode("2aMgaXMgMyBpbiBBcmFiaWM="); // "٣ is 3 in Arabic" * Strings.decode("VGhlIOKFsS1uZCBDZW50dXJ5IEIuIEMu"); * //= "The ⅱ-nd Century B. C." * ``` * * @param {String} base64 Contains a Base64-encoded string. * @return {String} the decoded string. * * @since v1.5.0 */ static decode(base64: string): string; /** * Returns the default string if the specified string is empty. * * **Usage Examples:** * ```typescript * Strings.defaultIfEmpty("", ""); // "" * Strings.defaultIfEmpty("", " "); // " " * Strings.defaultIfEmpty("", "--"); // "--" * ``` * * @param {String} str Contains some string. * @param {String} defaultStr Contains some default string. * @return {String} the default string if the specified string is empty. */ static defaultIfEmpty(str: string, defaultStr: string): string; /** * Gets the part of the second string which is not contained in the * first string or vice-versa. * * **Usage Examples:** * ```typescript * Strings.difference("abc", "abc"); // "" * Strings.difference("abc ", "abc"); // " " * Strings.difference("abc", "abc def"); // " def" * ``` * * @param {String} str1 Contains some string. * @param {String} str2 Contains some other string. * @return {String} the part of the second string which is not contained * in the first string or vice-versa. */ static difference(str1: string, str2: string): string; /** * Encodes the specified string using Base64 encoding. * * **Usage Examples:** * ```typescript * Strings.encode("\u06f1\u06f2\u06f3"); // "27Hbstuz" * Strings.encode("\u0663 is 3 in Arabic"); // "2aMgaXMgMyBpbiBBcmFiaWM=" * Strings.encode("The \u2171-nd Century B. C."); * //= "VGhlIOKFsS1uZCBDZW50dXJ5IEIuIEMu" * ``` * * @param {String} str Contains the string to be encoded. * @param {Boolean} lineBreak Contains whether to break the base64 string * into lines of at most 80 characters. * @return {String} the encoded string. * * @since v1.5.0 */ static encode(str: string, lineBreak?: boolean): string; /** * Checks whether the specified string ends with the given substring. * * **Usage Examples:** * ```typescript * Strings.endsWith("", "ab"); // false * Strings.endsWith("abc", "c"); // true * Strings.endsWith("abc de", "DE", true); // true * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @param {Boolean} ignoreCase Contains whether to ignore case sensitivity. * Defaults to `false`. * @return {Boolean} whether the specified string ends with the given * substring. */ static endsWith(str: string, substring: string, ignoreCase?: boolean): boolean; /** * Checks whether the specified string ends with either of the specified * substrings. * * **Usage Examples:** * ```typescript * Strings.endsWithAny(""); // false * Strings.endsWithAny("abc"); // false * Strings.endsWithAny("abc", ""); // true * Strings.endsWithAny("abc def", "f"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} the specified string ends with either of the specified * substrings. */ static endsWithAny(str: string, ...substrings: string[]): boolean; /** * Checks whether the specified string ends with the specified substring * by ignoring case-sensitivity. * * **Usage Examples:** * ```typescript * Strings.endsWithIgnoreCase("", ""); // true * Strings.endsWithIgnoreCase("abc", ""); // true * Strings.endsWithIgnoreCase("", "abc"); // false * Strings.endsWithIgnoreCase("abc", "bC"); // true * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {Boolean} whether the specified string ends with the specified * substring by ignoring case-sensitivity. */ static endsWithIgnoreCase(str: string, substring: string): boolean; /** * Checks whether the specified string ends with neither of the specified * substrings. * * **Usage Examples:** * ```typescript * Strings.endsWithNone(""); // false * Strings.endsWithNone("", "abc"); // true * Strings.endsWithNone("abc", ""); // false * Strings.endsWithNone("abc", "d", "e", "f"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some string sequences. * @return {Boolean} whether the specified string ends with neither of the * specified substrings. */ static endsWithNone(str: string, ...substrings: string[]): boolean; /** * Checks whether the specified strings equal. * * @param {String} a Contains some string. * @param {String} b Contains some other string. * @return {Boolean} whether the specified strings equal. */ static equals(a: string, b: string): boolean; /** * Checks whether the specified strings equal. * * @param {String} a Contains some string. * @param {String} b Contains some other string. * @return {Boolean} whether the specified strings equal. */ static equals(a: String, b: String): boolean; /** * Checks whether the two specified strings equal by ignoring case * sensitivity. * * **Usage Examples:** * ```typescript * Strings.equalsIgnoreCase("", ""); // true * Strings.equalsIgnoreCase("abc", "aBC"); // true * Strings.equalsIgnoreCase("abc", "Ab"); // false * ``` * * @param {String} str1 Contains some string. * @param {String} str2 Contains some other string. * @return {Boolean} whether the two specified strings equal by ignoring * case-sensitivity. */ static equalsIgnoreCase(str1: string, str2: string): boolean; /** * Checks whether the specified string equals any of the specified substrings. * * **Usage Examples:** * ```typescript * Strings.equalsAny(""); // false * Strings.equalsAny("", ""); // true * Strings.equalsAny("abc", "ghi"); // false * Strings.equalsAny("abc", "def", "abc", "mno"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} whether the specified string equals any of the specified * substrings. */ static equalsAny(str: string, ...substrings: string[]): boolean; /** * Checks whether the specified string equals either of the specified * substrings by ignoring case-sensitivity. * * **Usage Examples:** * ```typescript * Strings.equalsAnyIgnoreCase(""); // false * Strings.equalsAnyIgnoreCase("", ""); // true * Strings.equalsAnyIgnoreCase("abc", "ghi"); // false * Strings.equalsAnyIgnoreCase("abc", "def", "ABc", "mno"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} whether the specified string equals either of the * specified substrings by ignoring case-sensitivity. */ static equalsAnyIgnoreCase(str: string, ...substrings: string[]): boolean; /** * Converts a binary string to Unicode in case it has previously * contained Unicode. * * **Usage Examples:** * ```typescript * Strings.fromBinary(Strings.decode('PsOYFMOdIAA9w5hDw54=')); // "🤔 🙃" * ``` * * @param {String} binaryStr Contains some binary string. * @return {String} a string which might contain Unicode. * * @since v1.5.0 */ static fromBinary(binaryStr: string): string; /** * Converts an UTF-8 encoded bytes array to string. * * @param {Uint8Array} bytes Contains the UTF-8 encoded bytes array. * @return {String} a Base64-encoded string. * * @since v1.5.0 */ static fromBytesArray(bytes: Uint8Array): string; /** * Gets the string bytes. * * **Usage Examples:** * ```typescript * Strings.getBytes(""); // 0 * Strings.getBytes("abc"); // 3 * Strings.getBytes("🤔 🙃"); // 9 * Strings.getBytes("🤔 abc"); 8 * ``` * * @param {String} str Contains some string. * @return {Number} the string bytes. */ static getBytes(str: string): number; /** * Gets the hash code of the specified string. * * @param {String} str Contains some string. * @return {Number} the hash code. */ static hashCode(str: string): number; /** * Checks whether the given string has whitespaces. * * **Usage Examples:** * ```typescript * Strings.hasWhitespace("Lorem"); // false * Strings.hasWhitespace("Lor em"); // true * Strings.hasWhitespace("Lorem\n"); // true * Strings.hasWhitespace("Lorem\r"); // true * Strings.hasWhitespace("Lorem\t"); // true * Strings.hasWhitespace("Lorem\f"); // true * Strings.hasWhitespace(""); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the given string has whitespaces. */ static hasWhitespace(str: string): boolean; /** * Gets the first index of any of the specified substrings in the * specified string. * * **Usage Examples:** * ```typescript * Strings.indexOfAny(""); // -1 * Strings.indexOfAny("abc"); // -1 * Strings.indexOfAny("abc", ""); // 0 * Strings.indexOfAny("abcde", "de"); // 3 * Strings.indexOfAny("abcde", "fgh", "cde"); // 2 * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Number} the first index of any of the specified substrings * in the specified string. */ static indexOfAny(str: string, ...substrings: string[]): number; /** * Gets the first index at which the characters of both strings begin * to differ. If both strings are equal, the method returns -1. * * **Usage Examples:** * ```typescript * Strings.indexOfDifference("", ""); // -1 * Strings.indexOfDifference("", "a"); // 0 * Strings.indexOfDifference("a", ""); // 0 * Strings.indexOfDifference("abcde", "abc"); // 3 * Strings.indexOfDifference("abc", "abcde"); // 3 * ``` * * @param {String} str1 Contains some string. * @param {String} str2 Contains some other string. * @return {Number} the index at which the characters of both strings * begin to differ. */ static indexOfDifference(str1: string, str2: string): number; /** * Gets the first index of the specified substring in the given string. * This method is case-insensitive. If the specified substring is not * contained in the given string, -1 is returned. * * **Usage Examples:** * ```typescript * Strings.indexOfIgnoreCase("", ""); // 0 * Strings.indexOfIgnoreCase("abc", ""); // 0 * Strings.indexOfIgnoreCase("abcde", "DE"); // 3 * Strings.indexOfIgnoreCase("abcde", "cde"); // 2 * ``` * * @param {String} str Contains some string. * @param {String} sequence Contains some string sequence. * @return {Number} the index of the specified substring in the given * string. */ static indexOfIgnoreCase(str: string, sequence: string): number; /** * Checks whether the specified string is all blank i. e. white space. * * **Usage Examples:** * ```typescript * Strings.isAllBlank(''); // true * Strings.isAllBlank(' '); // true * Strings.isAllBlank('\n'); // true * Strings.isAllBlank('\t'); // true * Strings.isAllBlank('\r'); // true * Strings.isAllBlank('\f'); // true * Strings.isAllBlank('\f\n'); // true * Strings.isAllBlank('\t\r\f'); // true * Strings.isAllBlank('\f\t\r\n\na'); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is all blank i. e. * white space. * * @see `Strings.isWhitespace()` */ static isAllBlank(str: string): boolean; /** * Checks whether the specified string contains only lowercase and * uppercase letters a - z and A - Z. * * **Usage Examples:** * ```typescript * Strings.isAlpha(''); // false * Strings.isAlpha('a'); // true * Strings.isAlpha('abc'); // true * Strings.isAlpha('abcDEF'); // true * Strings.isAlpha('abc DEF'); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string contains only lowercase * and uppercase letters a - z and A - Z. * * @since v1.4.1 */ static isAlpha(str: string): boolean; /** * Checks whether the specified string is an alphanumeric string. * * **Usage Examples:** * ```typescript * Strings.isAlphanumeric(''); // false * Strings.isAlphanumeric('a'); // true * Strings.isAlphanumeric('abc'); // true * Strings.isAlphanumeric('abcDEF'); // true * Strings.isAlphanumeric('abc DEF'); // false * Strings.isAlphanumeric('0123'); // true * Strings.isAlphanumeric('abcDEF123'); // true * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is an alphanumeric * string. * * @since v1.4.1 */ static isAlphanumeric(str: string): boolean; /** * Checks whether any of the specified strings is blank. * * **Usage Examples:** * ```typescript * Strings.isAnyBlank(); // true * Strings.isAnyBlank(''); // true * Strings.isAnyBlank('a'); // false * Strings.isAnyBlank('a', ''); // true * ``` * * @param {Array} strings Contains some strings. * @return {Boolean} whether any of the specified strings is blank. * * @since v1.4.1 */ static isAnyBlank(...strings: string[]): boolean; /** * Checks whether the given string is binary i. e. each character of the * string occupies only one byte. * * **Usage Examples:** * ```typescript * Strings.isBinary('☻'); // false * Strings.isBinary(''); // true * Strings.isBinary('abc'); // true * ``` * * @param {String} str Contains some string. * @return {Boolean} whether each character of the string occupies only * one byte. */ static isBinary(str: string): boolean; /** * Checks whether the specified string is empty/blank. * * **Usage Examples:** * ```typescript * Strings.isBlank(""); // true * Strings.isBlank(" "); // false * Strings.isBlank("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is empty/blank. * * @see `Strings.isEmpty()` */ static isBlank(str: string): boolean; /** * Checks whether the specified string is empty/blank. * * **Usage Examples:** * ```typescript * Strings.isEmpty(""); // true * Strings.isEmpty(" "); // false * Strings.isEmpty("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is empty/blank. * * @see `Strings.isBlank()` */ static isEmpty(str: string): boolean; /** * Checks whether all the characters of the specified string are * lowercase. * * **Usage Examples:** * ```typescript * Strings.isLowerCase(""); // true * Strings.isLowerCase("123"); // true * Strings.isLowerCase("abc"); // true * Strings.isLowerCase("Abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether all the characters of the specified * string are lowercase. */ static isLowerCase(str: string): boolean; /** * Checks whether the specified string contains at least one uppercase * and one lowercase character. * * **Usage Examples:** * ```typescript * Strings.isMixedCase(''); // false * Strings.isMixedCase(' '); // false * Strings.isMixedCase('abc'); // false * Strings.isMixedCase('Abc'); // true * Strings.isMixedCase('ab Cd ef'); // true * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string contains at least one * uppercase and one lowercase character. * * @since v1.4.1 */ static isMixedCase(str: string): boolean; /** * Checks whether the given string value is `null`, `undefined` or `""`. * * **Usage Examples:** * ```typescript * Strings.isNilOrEmpty(); // true * Strings.isNilOrEmpty(""); // true * Strings.isNilOrEmpty(" "); // false * Strings.isNilOrEmpty(null); // true * Strings.isNilOrEmpty(undefined); // true * Strings.isNilOrEmpty("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the given string value is `null`, `undefined` * or `""`. */ static isNilOrEmpty(str?: string | null | undefined): str is null | undefined; /** * Checks whether the given string is `null`, `undefined` or white space. * * **Usage Examples:** * ```typescript * Strings.isNilOrWhitespace(); // true * Strings.isNilOrWhitespace(""); // true * Strings.isNilOrWhitespace(" "); // true * Strings.isNilOrWhitespace("\t\r\n\f"); // true * Strings.isNilOrWhitespace(null); // true * Strings.isNilOrWhitespace(undefined); // true * Strings.isNilOrWhitespace("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the given string is `null`, `undefined` or * white space. */ static isNilOrWhitespace(str?: string | null): str is null; /** * Checks whether the specified string is not empty. * * **Usage Examples:** * ```typescript * Strings.isNotEmpty(""); // false * Strings.isNotEmpty(" "); // true * Strings.isNotEmpty("abc"); // true * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is not empty. */ static isNotEmpty(str: string): boolean; /** * Checks whether the specified string is equal to `null` or `""`. * * **Usage Examples:** * ```typescript * Strings.isNullOrEmpty(""); // true * Strings.isNullOrEmpty(null); // true * Strings.isNullOrEmpty(" "); // false * Strings.isNullOrEmpty("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is equal to `null` or `""`. */ static isNullOrEmpty(str: string | null): str is null; /** * Checks whether the specified string is equal to `null` or white space. * * **Usage Examples:** * ```typescript * Strings.isNullOrWhitespace(""); // true * Strings.isNullOrWhitespace(" "); // true * Strings.isNullOrWhitespace("\t\r\n\f"); // true * Strings.isNullOrWhitespace(null); // true * Strings.isNullOrWhitespace("abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is equal to `null` or * white space. */ static isNullOrWhitespace(str: string | null): str is null; /** * Checks whether the specified string represents a stringified number. * * **Usage Examples:** * ```typescript * Strings.isNumeric(""); // false * Strings.isNumeric("1e3"); // true * Strings.isNumeric("-0"); // true * Strings.isNumeric("123"); // true * Strings.isNumeric("\u0663\u0664"); // true * Strings.isNumeric("\u0663 \u0664"); // false * Strings.isNumeric("\u0664"); // true * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string represents a stringified * number. * * @since v1.4.2 */ static isNumeric(str: string): boolean; /** * Checks whether the specified value is a string. * * **Usage Examples:** * ```typescript * Strings.isString(); // false * Strings.isString(""); // true * Strings.isString(" "); // true * Strings.isString(null); // false * Strings.isString(undefined); // false * Strings.isString({}); // false * Strings.isString("abc"); // true * ``` * * @param {String} str Contains some value. * @return {Boolean} whether the specified value is a string. */ static isString(str?: any): str is string; /** * Checks whether the specified value is a string object i. e. `String`. * * **Usage Examples:** * ```typescript * Strings.isStringObject(); // false * Strings.isStringObject(""); // false * Strings.isStringObject(" "); // false * Strings.isStringObject(null); // false * Strings.isStringObject(undefined); // false * Strings.isStringObject({}); // false * Strings.isStringObject("abc"); // false * Strings.isStringObject(new String("abc")); // true * ``` * * @param {String} str Contains some value. * @return {Boolean} whether the specified value is a string object. */ static isStringObject(str?: any): str is String; /** * Checks whether the string character at the specified index together with * the next character create a surrogate pair. A surrogate pair according to * the [Unicode Standard](https://unicode.org/standard/standard.html) is a * combination of a Unicode code point from U+D800 to U+DBFF a. k. a. "high * surrogate" with another in range from U+DC00 to U+DFFF a. k. a. "low * surrogate". * * **Usage Examples:** * ```typescript * Strings.isSurrogatePair("🐑🐑🐑😀💖", 0); // true * Strings.isSurrogatePair("😀💖", 0); // true * Strings.isSurrogatePair("", 0); // false * Strings.isSurrogatePair("abc", 1); // false * ``` * * @param {String} str Contains some string. * @param {Number} index Contains the index of the character. The index * is zero-based i. e. begins with 0. * @return {Boolean} whether the string character at the specified index * is surrogate. */ static isSurrogatePair(str: string, index: number): boolean; /** * Checks whether all the characters of the specified string are * upper case. * * **Usage Examples:** * ```typescript * Strings.isUpperCase(""); // true * Strings.isUpperCase("123"); // true * Strings.isUpperCase("ABC"); // true * Strings.isUpperCase("Abc"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether all the characters of the specified * string are upper case. */ static isUpperCase(str: string): boolean; /** * Checks whether the specified string is all blank i. e. white space. * * **Usage Examples:** * ```typescript * Strings.isWhitespace(""); // true * Strings.isWhitespace(" "); // true * Strings.isWhitespace("\n"); // true * Strings.isWhitespace("\t"); // true * Strings.isWhitespace("\r"); // true * Strings.isWhitespace("\f"); // true * Strings.isWhitespace("\f\n"); // true * Strings.isWhitespace("\f\r"); // true * Strings.isWhitespace("\t\r\f"); // true * Strings.isWhitespace("\f\t\r\n\n"); // true * Strings.isWhitespace("\f\t\r\n\na"); // false * ``` * * @param {String} str Contains some string. * @return {Boolean} whether the specified string is all blank i. e. * white space. * * @see `Strings.isAllBlank()` */ static isWhitespace(str: string): boolean; /** * Concatenates the specified string with other strings. * * **Usage Examples:** * ```typescript * Strings.join("abc"); // "abc" * Strings.join("abc", ""); // "abc" * Strings.join("John", " ", "Doe"); // "John Doe" * ``` * * @param {String} str Contains some string. * @param {Array} otherStrs Contains some other strings. * @return {String} a string composed of a concatenation of all the given * strings. */ static join(str: string, ...otherStrs: string[]): string; /** * Gets the last index at which the specified substring is found in the * specified string. * * **Usage Examples:** * ```typescript * Strings.lastIndexOf("", ""); // 0 * Strings.lastIndexOf("abc", ""); // 0 * Strings.lastIndexOf("", "abc"); // -1 * Strings.lastIndexOf("Abcddemmaxdemala", "dem"); // 10 * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {Number} the last index at which the specified substring is * found in the specified string. */ static lastIndexOf(str: string, substring: string): number; /** * Gets the last index at which the specified substring is found in the * given string by ignoring case-sensitivity. * * **Usage Examples:** * ```typescript * Strings.lastIndexOfIgnoreCase("", ""); // 0 * Strings.lastIndexOfIgnoreCase("abc", ""); // 0 * Strings.lastIndexOfIgnoreCase("", "abc"); // -1 * Strings.lastIndexOfIgnoreCase("Abcddemmaxdemala", "DEm"); // 10 * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {Number} the last index at which the specified substring is * located in the given string by ignoring case-sensitivity. */ static lastIndexOfIgnoreCase(str: string, substring: string): number; /** * Gets the `length` leftmost characters of the specified string. * * **Usage Examples:** * ```typescript * Strings.left("abc", 2); // "ab" * Strings.left("abc", 5); // "abc" * Strings.left("Alphabet", 5); // "Alpha" * ``` * * @param {String} str Contains some string. * @param {Number} length Contains the number of characters to pick from the * beginning of the specified string. * @return {String} the first `length` characters of the string. */ static left(str: string, length: number): string; /** * Gets the longest of the specified strings. * * **Usage Examples:** * ```typescript * Strings.longest(); // "" * Strings.longest(""); // "" * Strings.longest("abc", "ab"); // "abc" * ``` * * @param {String} strings Contains some strings. * @return {String} the longest of the specified strings. */ static longest(...strings: string[]): string; /** * Normalizes the string white spaces i. e. if there are more than one * consecutive white space, only one of them remains. * * **Usage Examples:** * ```typescript * Strings.normalize(" "); // "" * Strings.normalize(" Bye - bye ! "); // "Bye - bye !" * Strings.normalize(" Lorem ipsum dolor sit "); // "Lorem ipsum dolor sit" * ``` * * @param {String} str Contains some string. * @return {String} the normalized string. */ static normalize(str: string): string; /** * Appends the specified prefix to the beginning of the given string. * * **Usage Examples:** * ```typescript * Strings.prepend("a", ""); // "a" * Strings.prepend("", "abc"); // "abc" * Strings.prepend("a", "bc"); // "bca" * ``` * * @param {String} str Contains some string. * @param {String} prefix Contains some string prefix. * @return {String} a string. */ static prepend(str: string, prefix: string): string; /** * Appends the specified prefix to the beginning of the given string in * case it does not begin with it. * * **Usage Examples:** * ```typescript * Strings.prependIfMissing("", "abc"); // "abc" * Strings.prependIfMissing("a", "bc"); // "bca" * Strings.prependIfMissing("a", ""); // "a" * Strings.prependIfMissing("abcde", "ab"); // "abcde" * Strings.prependIfMissing("ABcde", "ab", true); // "ABcde" * ``` * * @param {String} str Contains some string. * @param {String} prefix Contains some string prefix. * @param {Boolean} ignoreCase Contains whether to ignore case sensitivity. * Defaults to `false`. * @return {String} a string. */ static prependIfMissing(str: string, prefix: string, ignoreCase?: boolean): string; /** * Appends the specified prefix to the beginning of the string in case * the string does not begin with it by ignoring case-sensitivity. * * **Usage Examples:** * ```typescript * Strings.prependIfMissingIgnoreCase("", "abc"); // "abc" * Strings.prependIfMissingIgnoreCase("a", "bc"); // "bca" * Strings.prependIfMissingIgnoreCase("a", ""); // "a" * Strings.prependIfMissingIgnoreCase("abcde", "ab"); // "abcde" * Strings.prependIfMissingIgnoreCase("ABcde", "ab"); // "ABcde" * ``` * * @param {String} str Contains some string. * @param {String} prefix Contains some string prefix. * @return {String} the extended string. */ static prependIfMissingIgnoreCase(str: string, prefix: string): string; /** * Generates a random string. * * **Usage Examples:** * ```typescript * Strings.random(3, "abc"); // "cbc" * Strings.random(5); // "BZOke" * Strings.random(16); // "nHmFULXkUiIMohzq" * ``` * * @param {Number} length Contains the length of the string to be generated. * @param {String} charset Contains the charset. Defaults to "A-Za-z0-9". * @return {String} a random string. */ static random(length: number, charset?: string): string; /** * Removes all the string parts in the specified string which match the * specified substring. * * **Usage Examples:** * ```typescript * Strings.remove("", ""); // "--" * Strings.remove(" ", " "); // "--" * Strings.remove("black", "l"); // "back" * Strings.remove("Ole-Ole-Ole", "Ole"); // "--" * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring to be removed from * the given string. * @return {String} the string without the specified substring occurrences. */ static remove(str: string, substring: string): string; /** * Removes the specified substring from the given string if the string * ends with it; otherwise simply returns the given string. * * **Usage Examples:** * ```typescript * Strings.removeEnd("", "abc"); // "" * Strings.removeEnd("abc", ""); // "abc" * Strings.removeEnd("abcdefgh", "fgh"); // "abcde" * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {String} a string. */ static removeEnd(str: string, substring: string): string; /** * Removes the specified substring from the given string if the string ends * with it by ignoring case-sensitivity; otherwise simply returns the given * string. * * **Usage Examples:** * ```typescript * Strings.removeEndIgnoreCase("", "abc"); // "" * Strings.removeEndIgnoreCase("abc", ""); // "abc" * Strings.removeEndIgnoreCase("abcdefgh", "fgh"); // "abcde" * Strings.removeEndIgnoreCase("abcdefgh", "FGh"); // "abcde" * ``` * * @param {String} str Contains some string. * @param {String} substring Contains some substring. * @return {String} a string. */ static removeEndIgnoreCase(str: string, substring: string): string; /** * Removes all the white spaces from the specified string. * * **Usage Examples:** * ```typescript * Strings.removeWhitespace(""); // "" * Strings.removeWhitespace(" "); // "" * Strings.removeWhitespace("a b c\n"); // "abc" * Strings.removeWhitespace("\n\r\t\f "); // "" * Strings.removeWhitespace("abc @def.ghi"); // "abc@def.ghi" * ``` * * @param {String} str Contains some string. * @return {String} the string without white spaces. */ static removeWhitespace(str: string): string; /** * Repeats the specified string the given number of times. * * **Usage Examples:** * ```typescript * Strings.repeat("", 10); // "" * Strings.repeat(" ", 1); // " " * Strings.repeat("abc", 2); // "abcabc" * Strings.repeat("*", 10); // "**********" * ``` * * @param {String} str Contains some string. * @param {Number} times Contains the number of times to repeat the * specified string. * @return {String} the string repeated the specified number of times. */ static repeat(str: string, times: number): string; /** * Reverses the specified string. * * **Usage Examples:** * ```typescript * Strings.reverse(""); // "" * Strings.reverse("cba"); // "abc" * Strings.reverse("😃😄😁😆🤣"); // "🤣😆😁😄😃" * ``` * * @param {String} str Contains some string. * @return {String} the reversed string. * * @since v1.4.3 */ static reverse(str: string): string; /** * Replaces the string characters in the specified range by the given * substring. * * **Usage Examples:** * ```typescript * Strings.splice("", 0, 0, "abc"); // "abc" * Strings.splice("abcde", 1, 0, "hijk"); // "ahijkbcde" * Strings.splice("lorem ipsum dolor", 6, 5, "amet"); // "lorem amet dolor" * ``` * * @param {String} str Contains a string. * @param {Number} fromIndex Contains the start index at which to place the * new substring. * @param {Number} deleteCount Contains the number of characters to remove * from the specified `fromIndex` of the specified string. * @param {String} subStr Contains the new substring to be inserted between * the specified indexes. * * @return {string} a new string with the specified sequence replaced by the * new substring. * * @since v1.6.8 */ static splice(str: string, fromIndex: number, deleteCount: number, subStr: string): string; /** * Checks whether the specified string starts with the specified substring. * * **Usage Examples:** * ```typescript * Strings.startsWith("", "") // true * Strings.startsWith("abc", "ab") // true * Strings.startsWith("abc", "A", true) // true * Strings.startsWith("abc", "b") // false * Strings.startsWith("abc", "C", true) // false * ``` * * @param {String} str Contains some string. * @param {String} sequence Contains some substring. * @param {Boolean} ignoreCase Contains whether to ignore case-sensitivity. * Defaults to `false`. * @param {Number} position Contains the index at which to begin searching * in the specified string. If omitted, it starts with the string end. * @return {Boolean} whether the specified string starts with the specified * substring. */ static startsWith(str: string, sequence: string, ignoreCase?: boolean, position?: number): boolean; /** * Checks whether the specified string starts with any of the specified * substrings. * * **Usage Examples:** * ```typescript * Strings.startsWithAny(""); // false * Strings.startsWithAny("", ""); // true * Strings.startsWithAny("", "abc"); // false * Strings.startsWithAny("abc", ""); // false * Strings.startsWithAny("abc", "a"); // true * Strings.startsWithAny("abc", "a", "b"); // true * Strings.startsWithAny("abc", ...["a", "b", "c"]); // true * Strings.startsWithAny("abc def ghi", "mno", "pqr", "abc"); // true * ``` * * @param {String} str Contains some string. * @param {Array} substrings Contains some substrings. * @return {Boolean} whether the specified string starts with any of the * specified substrings. */ static startsWithAny(str: string, ...substrings: string[]): boolean; /** * Converts the specified string to binary string in case it contains * Unicode characters. A binary string is a string in which each 16-bit * unit occupies only 1 byte. * * **Usage Examples:** * ```typescript * const binary = Strings.toBinary("🤔 🙃"); * Strings.encode(binary); // "PtgU3SAAPdhD3g==" * ``` * * @param {String} str Contains some string. * @return {String} a binary string. * * @since v1.5.0 */ static toBinary(str: string): string; /** * Converts the specified string to a UTF8 bytes array. * * @param {String} str Contains some string. * @return {Uint8Array} an UTF8 array. * * @since v1.5.0 */ static toBytesArray(str: string): Uint8Array; /** * Converts the specified string to camel-case. * * **Usage Examples:** * ```typescript * Strings.toCamelCase(""); // "" * Strings.toCamelCase("\n\t\n"); // "" * Strings.toCamelCase("foo bar baz"); // "fooBarBaz" * ``` * * @param {String} str Contains some string. * @return {String} the specified string converted to camel-case. */ static toCamelCase(str: string): string; /** * Converts the specified string to an array of characters. * * **Usage Examples:** * ```typescript * Strings.toCharArray(''); // [] * Strings.toCharArray('abc'); // ['a', 'b', 'c'] * Strings.toCharArray('🐑🐑🐑'); // ['🐑', '🐑', '🐑']; * ``` * * @param {String} str Contains some string. * @return {Array} an array of the characters of the specified string. */ static toCharArray(str: string): string[]; /** * Converts the specified string to constant-case. * * **Usage Examples:** * ```typescript * Strings.toConstantCase(""); // "" * Strings.toConstantCase("ABC"); // "ABC" * Strings.toConstantCase("aBC\nDeF"); // "ABC_DEF" * ``` * * @param {String} str Contains some string. * @return {String} the specified string converted to constant-case. * * @since v1.5.10 */ static toConstantCase(str: string): string; /** * Converts the specified string to kebab-case. * * **Usage Examples:** * ```typescript * Strings.toKebabCase(""); // "" * Strings.toKebabCase("ABC"); // "abc" * Strings.toKebabCase("aBC\nDeF"); // "abc-def" * ``` * * @param {String} str Contains some string. * @return {String} the specified string converted to kebab-case. */ static toKebabCase(str: string): string; /** * Converts the specified string to pascal-case. * * **Usage Examples:** * ```typescript * Strings.toPascalCase(""); // "" * Strings.toPascalCase(" "); // "" * Strings.toPascalCase("abc def"); // "AbcDef" * Strings.toPascalCase("abc_def"); // "AbcDef" * ``` * * @param {String} str Contains some string. * @return {String} the specified string converted to pascal-case. */ static toPascalCase(str: string): string; /** * Converts the specified string to snake-case. * * **Usage Examples:** * ```typescript * Strings.toSnakeCase(""); // "" * Strings.toSnakeCase("ABC"); // "abc" * Strings.toSnakeCase("aBC\nDeF"); // "abc_def" * ``` * * @param {String} str Contains some string. * @return {String} the specified string converted to snake-case. * * @since v1.5.0 */ static toSnakeCase(str: string): string; /** * Converts the specified string to title case id este the first letter * of the words between spaces is capitalized and the rest is converted * to lowercase. * * **Usage Examples:** * ```typescript * Strings.toTitleCase(""); // "" * Strings.toTitleCase("aBc"); // "Abc" * Strings.toTitleCase("aBC dEf"); // "Abc Def" * Strings.toTitleCase("\nabC"); // "\nAbc" * Strings.toTitleCase("ab\t\f\t\nc"); // "Ab\t\f\t\nC" * ``` * * @param {String} str Contains some string. * @return {String} the title case string. */ static toTitleCase(str: string): string; /** * Capitalizes the specified string. * * **Usage Examples:** * ```typescript * Strings.upperFirst("john"); // "John" * Strings.upperFirst("jOHN"); // "JOHN" * Strings.upperFirst("jOHN", true); // "John" * ``` * * @param {String} str Contains some string. * @param {Boolean} lowerRest Contains whether to convert the characters * from the second to the last character to lowercase. Defaults to `false`. * @return {String} the capitalized string. */ static upperFirst(str: string, lowerRest?: boolean): string; /** * @private * * @since v1.5.11 */ private static __toCase; }