javascript 字符串对象新增 replaceAll 方法

String.prototype.replaceAll = function(reallyDo, replaceWith, ignoreCase)

{

    if(! RegExp.prototype.isPrototypeOf(reallyDo))

    {

         return this.replace(new RegExp(reallyDo,(ignoreCase?"gi":g)),replaceWith);

    }

   else

   {

       return this.replace(reallyDo, replaceWith);

   }

}

原文地址:https://www.cnblogs.com/yiliweichinasoft/p/3330318.html