//可替换特殊符号$等,但无法忽略大小写的函数 String.prototype.replaceStr = function (s1, s2) { this.str = this; if (s1.length == 0) return this.str; var idx = this.str.indexOf(s1); while (idx > -1) { this.str = this.str.substring(0, idx) + s2 + this.str.substr(idx + s1.length); idx = this.str.indexOf(s1); } return this.str; }
时间: 2024-10-29 20:09:49