Javascript版のStringBuffer
456 ワード
/** StringBuffer **/
function StringBuffer() {
this._strings = new Array();
}
StringBuffer.prototype.append = function(str) {
this._strings.push(str);
return this;
};
StringBuffer.prototype.toString = function() {
var str = arguments.length == 0 ? """" : arguments[0];
return this._strings.join(str);
};
StringBuffer.prototype.clear = function() { //
this._strings.length = 0;
};