清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
1、替换全部
1 2 3 | String.prototype.replaceAll = function (s1, s2) { return this .replace( new RegExp(s1, "gm" ), s2) } |
2、清除空格
1 2 3 4 | String.prototype.trim = function () { var reExtraSpace = /^\s*(.*?)\s+$/; return this .replace(reExtraSpace, "$1" ) } |