Hierarchy

  • String
    • StringUtils

Constructors

  • Parameters

    • Optional value: any

    Returns StringUtils

Properties

length: number

Returns the length of a String object.

Methods

  • Iterator

    Returns IterableIterator<string>

  • Returns an <a> HTML anchor element and sets the name attribute to the text value

    Parameters

    • name: string

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.

    Parameters

    • index: number

    Returns undefined | string

  • Returns a <big> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <blink> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <b> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns the character at the specified index.

    Parameters

    • pos: number

      The zero-based index of the desired character.

    Returns string

  • Returns the Unicode value of the character at the specified location.

    Parameters

    • index: number

      The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.

    Returns number

  • Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point value of the UTF-16 encoded code point starting at the string element at position pos in the String resulting from converting this object to a String. If there is no element at that position, the result is undefined. If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.

    Parameters

    • pos: number

    Returns undefined | number

  • Returns a string that contains the concatenation of two or more strings.

    Parameters

    • Rest ...strings: string[]

      The strings to append to the end of the string.

    Returns string

  • Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.

    Parameters

    • searchString: string
    • Optional endPosition: number

    Returns boolean

  • Returns a <tt> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <font> HTML element and sets the color attribute value

    Parameters

    • color: string

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <font> HTML element and sets the size attribute value

    Parameters

    • size: number

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <font> HTML element and sets the size attribute value

    Parameters

    • size: string

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

    Parameters

    • searchString: string

      search string

    • Optional position: number

      If position is undefined, 0 is assumed, so as to search all of the String.

    Returns boolean

  • Returns the position of the first occurrence of a substring.

    Parameters

    • searchString: string

      The substring to search for in the string

    • Optional position: number

      The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.

    Returns number

  • Returns an <i> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns the last occurrence of a substring in the string.

    Parameters

    • searchString: string

      The substring to search for.

    • Optional position: number

      The index at which to begin searching. If omitted, the search begins at the end of the string.

    Returns number

  • Returns an <a> HTML element and sets the href attribute value

    Parameters

    • url: string

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Determines whether two strings are equivalent in the current locale.

    Parameters

    • that: string

      String to compare to target string

    Returns number

  • Determines whether two strings are equivalent in the current or specified locale.

    Parameters

    • that: string

      String to compare to target string

    • Optional locales: string | string[]

      A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.

    • Optional options: CollatorOptions

      An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.

    Returns number

  • Matches a string with a regular expression, and returns an array containing the results of that search.

    Parameters

    • regexp: string | RegExp

      A variable name or string literal containing the regular expression pattern and flags.

    Returns null | RegExpMatchArray

  • Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.

    Parameters

    • matcher: {
          [match](string): null | RegExpMatchArray;
      }

      An object that supports being matched against.

      • [match]:function
        • Parameters

          • string: string

          Returns null | RegExpMatchArray

    Returns null | RegExpMatchArray

  • Matches a string with a regular expression, and returns an iterable of matches containing the results of that search.

    Parameters

    • regexp: RegExp

      A variable name or string literal containing the regular expression pattern and flags.

    Returns IterableIterator<RegExpMatchArray>

  • Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.

    Parameters

    • form: "NFC" | "NFD" | "NFKC" | "NFKD"

      Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC"

    Returns string

  • Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.

    Parameters

    • Optional form: string

      Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC"

    Returns string

  • Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the end (right) of the current string.

    Parameters

    • maxLength: number

      The length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is.

    • Optional fillString: string

      The string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020).

    Returns string

  • Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length. The padding is applied from the start (left) of the current string.

    Parameters

    • maxLength: number

      The length of the resulting string once the current string has been padded. If this parameter is smaller than the current string's length, the current string will be returned as it is.

    • Optional fillString: string

      The string to pad the current string with. If this string is too long, it will be truncated and the left-most part will be applied. The default value for this parameter is " " (U+0020).

    Returns string

  • Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned.

    Parameters

    • count: number

      number of copies to append

    Returns string

  • Replaces text in a string, using a regular expression or search string.

    Parameters

    • searchValue: string | RegExp

      A string or regular expression to search for.

    • replaceValue: string

      A string containing the text to replace. When the searchValue is a RegExp, all matches are replaced if the g flag is set (or only those matches at the beginning, if the y flag is also present). Otherwise, only the first match of searchValue is replaced.

    Returns string

  • Replaces text in a string, using a regular expression or search string.

    Parameters

    • searchValue: string | RegExp

      A string to search for.

    • replacer: ((substring, ...args) => string)

      A function that returns the replacement text.

        • (substring, ...args): string
        • Parameters

          • substring: string
          • Rest ...args: any[]

          Returns string

    Returns string

  • Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

    Parameters

    • searchValue: {
          [replace](string, replaceValue): string;
      }

      An object that supports searching for and replacing matches within a string.

      • [replace]:function
        • Parameters

          • string: string
          • replaceValue: string

          Returns string

    • replaceValue: string

      The replacement text.

    Returns string

  • Replaces text in a string, using an object that supports replacement within a string.

    Parameters

    • searchValue: {
          [replace](string, replacer): string;
      }

      A object can search for and replace matches within a string.

      • [replace]:function
        • Parameters

          • string: string
          • replacer: ((substring, ...args) => string)
              • (substring, ...args): string
              • Parameters

                • substring: string
                • Rest ...args: any[]

                Returns string

          Returns string

    • replacer: ((substring, ...args) => string)

      A function that returns the replacement text.

        • (substring, ...args): string
        • Parameters

          • substring: string
          • Rest ...args: any[]

          Returns string

    Returns string

  • Finds the first substring match in a regular expression search.

    Parameters

    • regexp: string | RegExp

      The regular expression pattern and applicable flags.

    Returns number

  • Finds the first substring match in a regular expression search.

    Parameters

    • searcher: {
          [search](string): number;
      }

      An object which supports searching within a string.

      • [search]:function
        • Parameters

          • string: string

          Returns number

    Returns number

  • Returns a section of a string.

    Parameters

    • Optional start: number

      The index to the beginning of the specified portion of stringObj.

    • Optional end: number

      The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of stringObj.

    Returns string

  • Returns a <small> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Split a string into substrings using the specified separator and return them as an array.

    Parameters

    • separator: string | RegExp

      A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

    • Optional limit: number

      A value used to limit the number of elements returned in the array.

    Returns string[]

  • Split a string into substrings using the specified separator and return them as an array.

    Parameters

    • splitter: {
          [split](string, limit?): string[];
      }

      An object that can split a string.

      • [split]:function
        • Parameters

          • string: string
          • Optional limit: number

          Returns string[]

    • Optional limit: number

      A value used to limit the number of elements returned in the array.

    Returns string[]

  • Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

    Parameters

    • searchString: string
    • Optional position: number

    Returns boolean

  • Returns a <strike> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns a <sub> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Gets a substring beginning at the specified location and having the specified length.

    Parameters

    • from: number

      The starting position of the desired substring. The index of the first character in the string is zero.

    • Optional length: number

      The number of characters to include in the returned substring.

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Returns the substring at the specified location within a String object.

    Parameters

    • start: number

      The zero-based index number indicating the beginning of the substring.

    • Optional end: number

      Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. If end is omitted, the characters from start through the end of the original string are returned.

    Returns string

  • Returns a <sup> HTML element

    Returns string

    Deprecated

    A legacy feature for browser compatibility

  • Converts all alphabetic characters to lowercase, taking into account the host environment's current locale.

    Parameters

    • Optional locales: string | string[]

    Returns string

  • Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.

    Parameters

    • Optional locales: string | string[]

    Returns string

  • Converts all the alphabetic characters in a string to lowercase.

    Returns string

  • Returns a string representation of a string.

    Returns string

  • Converts all the alphabetic characters in a string to uppercase.

    Returns string

  • Removes the leading and trailing white space and line terminator characters from a string.

    Returns string

  • Removes the trailing white space and line terminator characters from a string.

    Returns string

  • Removes the leading white space and line terminator characters from a string.

    Returns string

    Deprecated

    A legacy feature for browser compatibility. Use trimStart instead

  • Removes the trailing white space and line terminator characters from a string.

    Returns string

    Deprecated

    A legacy feature for browser compatibility. Use trimEnd instead

  • Removes the leading white space and line terminator characters from a string.

    Returns string

  • Returns the primitive value of the specified object.

    Returns string

  • The function charAt takes a string and an index as input and returns the character at the specified index in the string.

    Parameters

    • str: string

      A string

    • index: number

      The index parameter in the charAt function represents the position of the character you want to retrieve from the str string. It is a number that indicates the zero-based index of the character you want to access.

    Returns string

    The charAt function is returning the character at the specified index in the given string.

  • The function charCodeAt takes a string and an index, and returns the Unicode value of the character at that index in the string.

    Parameters

    • str: string

      a string

    • index: number

      The index parameter in the charCodeAt function represents the position of the character in the string str for which you want to retrieve the Unicode value. The index is a zero-based integer value indicating the position of the character in the string.

    Returns number

    The charCodeAt function is returning the Unicode value of the character at the specified index in the given string.

  • The function endsWith checks if a string ends with a specified search value.

    Parameters

    • str: string

      a strubg

    • searchValue: string

      The searchValue parameter is the string that the endsWith method will check if the input string ends with.

    • Optional position: number

      The position parameter in the endsWith function is an optional parameter that specifies the position within the string at which to stop searching for the specified searchValue. If provided, the endsWith function will only search within the substring starting from the beginning of the string up to the specified position

    Returns boolean

    The endsWith method is being called on the str string with the searchValue and optional position arguments, and the result of this method call is being returned as a boolean value.

  • Parameters

    • Rest ...codes: number[]

    Returns string

  • Return the String value whose elements are, in order, the elements in the List elements. If length is 0, the empty string is returned.

    Parameters

    • Rest ...codePoints: number[]

    Returns string

  • The static includes function checks if a string includes a specific search value at an optional specified position.

    Parameters

    • str: string

      a string

    • searchValue: string

      The searchValue parameter is the string that you want to search for within the str string.

    • Optional position: number

      The position parameter in the includes function is an optional parameter that specifies the position within the string at which to begin searching for the searchValue. If provided, the includes function will start searching for the searchValue at the specified position within the str string

    Returns boolean

    The includes function is returning a boolean value indicating whether the searchValue is found within the str string starting from the optional position index.

  • The indexOf function in TypeScript returns the index of the first occurrence of a specified value within a string, starting the search at a specified index if provided.

    Parameters

    • str: string

      a string

    • searchValue: string

      The searchValue parameter is the string that you want to find within the str string.

    • Optional fromIndex: number

      The fromIndex parameter in the indexOf function is an optional parameter that specifies the index at which to start the search for the searchValue within the str string. If provided, the search will start at the specified index. If not provided, the search will start at

    Returns number

    The indexOf method is being called on the str string with the searchValue and optional fromIndex parameters. The method returns the index of the first occurrence of the searchValue within the str string, starting the search at the optional fromIndex if provided.

  • The function lastIndexOf returns the index of the last occurrence of a specified value within a string.

    Parameters

    • str: string

      a string

    • searchValue: string

      The searchValue parameter is the string value that you want to find within the str string.

    • Optional fromIndex: number

      The fromIndex parameter in the lastIndexOf function is an optional parameter that specifies the index at which to start searching backwards in the string. If this parameter is not provided, the search will start from the end of the string.

    Returns number

    The lastIndexOf method is being called on the str string with the searchValue and optional fromIndex parameters. The method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the specified index fromIndex.

  • String.raw is usually used as a tag function of a Tagged Template String. When called as such, the first argument will be a well formed template call site object and the rest parameter will contain the substitution values. It can also be called directly, for example, to interleave strings and values from your own tag function, and in this case the only thing it needs from the first argument is the raw property.

    Parameters

    • template: {
          raw: readonly string[] | ArrayLike<string>;
      }

      A well-formed template string call site representation.

      • raw: readonly string[] | ArrayLike<string>
    • Rest ...substitutions: any[]

      A set of substitution values.

    Returns string

  • The repeat function takes a string and a count, and returns the string repeated the specified number of times.

    Parameters

    • str: string

      a string

    • count: number

      The count parameter specifies the number of times the str parameter should be repeated in the repeat function.

    Returns string

    The repeat function is returning a new string that is the concatenation of the input string str repeated count number of times.

  • The function replaces all occurrences of a specified search value in a string with a specified replace value.

    Parameters

    • str: string

      a string

    • searchValue: string | RegExp

      The searchValue parameter in the replace function can be either a string or a regular expression. It is the value that you want to search for in the input string str and replace with the replaceValue.

    • replaceValue: string

      The replaceValue parameter in the replace function is the value that will replace the searchValue in the input str string. It can be a string that will replace all occurrences of the searchValue in the input string.

    Returns string

    The replace function is returning a modified string where all occurrences of the searchValue have been replaced with the replaceValue.

  • The reverse function in TypeScript takes a string as input and returns the reversed version of that string.

    Parameters

    • str: string

      a string

    Returns string

    The reverse function takes a string as input, splits it into an array of characters, reverses the order of the characters in the array, and then joins them back together into a new string. The function returns this new string that has the characters in reverse order.

  • The slice function takes a string, a starting index, and an optional ending index, and returns a substring based on the indices provided.

    Parameters

    • str: string

      a string

    • start: number

      The start parameter in the slice function represents the index at which to begin extraction. This means that the function will start slicing the string from the character at the index specified by the start parameter.

    • Optional end: number

      The end parameter in the slice function is an optional parameter that specifies the end index at which to end the extraction of characters from the string. If the end parameter is not provided, the extraction will continue to the end of the string.

    Returns string

    The slice method is being called on the str string with the start and optional end parameters. The method returns a new string that is a subset of the original string starting from the start index up to (but not including) the end index.

  • The split function in TypeScript splits a string into an array of substrings based on a specified separator and optional limit.

    Parameters

    • str: string

      a string

    • separator: string | RegExp

      The separator parameter in the split function is used to specify the character or regular expression at which the str should be split into an array of substrings.

    • Optional limit: number

      The limit parameter in the split function specifies the maximum number of splits to be performed on the input string. If the limit parameter is provided, the split function will split the input string into substrings at each occurrence of the specified separator up to the limit specified.

    Returns string[]

    The split function is returning an array of strings after splitting the input str based on the separator and limit provided.

  • This static function checks if a string starts with a specified search value at an optional position.

    Parameters

    • str: string

      a string

    • searchValue: string

      The searchValue parameter is the string that the startsWith method will check if the given string str starts with.

    • Optional position: number

      The position parameter in the startsWith function is an optional parameter that specifies the position within the string at which to begin searching for the searchValue. If provided, the function will only check if the string starts with the searchValue starting from the specified position. If not provided

    Returns boolean

    The startsWith method is being returned, which checks if a string starts with the specified value.

  • The function "substring" takes a string, a start index, and an optional end index, and returns a substring of the original string based on the provided indices.

    Parameters

    • str: string

      a string

    • start: number

      The start parameter in the substring function represents the index at which to begin extracting characters from the string.

    • Optional end: number

      The end parameter in the substring function is an optional parameter that specifies the index at which to end the extraction of characters from the string. If the end parameter is not provided, the extraction will continue to the end of the string.

    Returns string

    The substring function is returning a substring of the input string str starting at the index start and ending at the index end (if provided).

  • The function toLowerCase takes a string as input and returns the string converted to lowercase.

    Parameters

    • str: string

      The parameter str is a string that represents the input text that you want to convert to lowercase.

    Returns string

    The toLowerCase method is being called on the input string str, converting all characters to lowercase, and then returning the resulting lowercase string.

Generated using TypeDoc