@nevware21/ts-utils
    Preparing search index...

    Function strReplaceAll

    • The strReplaceAll() method returns a new string with all matches of a pattern replaced by a replacement.

      Parameters

      • value: string

        The string value to search and replace within.

      • searchValue: string | RegExp

        The value to search for. Can be a string or a global regular expression.

      • replaceValue: string | ((substring: string, ...args: any[]) => string)

        The replacement string or replacer function.

      Returns string

      A new string with every occurrence of searchValue replaced.

      0.14.0

      TypeError if searchValue is a regular expression without the global flag.

      strReplaceAll("a-b-a", "a", "x");       // "x-b-x"
      strReplaceAll("abc123abc", /abc/g, "X"); // "X123X"
      strReplaceAll("abca", "a", (value, index) => value.toUpperCase() + index);
      // "A0bcA3"