实现:
this.strings.push(str);
return this;
}
StringBuffer.prototype.ToString = function () {
return this.strings.join('');
};
StringBuffer.prototype.clear = function () {
this.strings = [];
}
StringBuffer.prototype.size = function () {
return this.strings.length;
}
return this;
}
StringBuffer.prototype.ToString = function () {
return this.strings.join('');
};
StringBuffer.prototype.clear = function () {
this.strings = [];
}
StringBuffer.prototype.size = function () {
return this.strings.length;
}
实例化调用
console.log(sbHtml.ToString());
以上这篇js实现StringBuffer的简单实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。
原文链接:https://www.f2er.com/js/46144.html