replaceAll is not a function

重写replaceAll方法

自定义在文件中,可直接使用

String.prototype.replaceAll = function(search, replacement) {
			var pattern = search.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$&');
			return this.replace(new RegExp(pattern, 'g'), replacement);
		};

已有 0 条评论

    欢迎您,新朋友,感谢参与互动!