@extremejs/utils - v1.0.0-beta.23
    Preparing search index...

    Function replace

    • It will replace matches for the searchValue in the string with the replaceValue.

      Parameters

      • string: string
      • searchValue: string | RegExp
      • replaceValue: string | ((substring: string, ...args: any[]) => string)
      • all: boolean = false

      Returns string

      1.0.0

      replace("Hi Fred, I'm Fred!", "Fred", "Barney"); // => "Hi Barney, I'm Fred!"
      
      replace("Hi Fred, I'm Fred too!", "Fred", "Barney", true); // => "Hi Barney, I'm Barney too!"