js 字符连接对象
程序员文章站
2022-06-14 16:29:15
...
function StringBuffer(){
this.str = [];
}
StringBuffer.prototype = {
append:function(str){
this.str.push(str);
return this;
},
toString:function(){
return this.str.join('');
},
clear:function(){
this.str.length = 0;
return this;
}
}
this.str = [];
}
StringBuffer.prototype = {
append:function(str){
this.str.push(str);
return this;
},
toString:function(){
return this.str.join('');
},
clear:function(){
this.str.length = 0;
return this;
}
}