개발/JQUERY
제이쿼리 stringbuffer
료팡
2017. 3. 17. 09:16
if ('undefined' != typeof(StringBuffer)) {
StringBuffer = {};
}
StringBuffer = function(str) {
this._aString = [];
if ('undefined' != typeof(str)) {
this.append(str);
}
};
StringBuffer.prototype.append = function(str) {
this._aString.push(str);
return this;
};
StringBuffer.prototype.toString = function() {
return this._aString.join('');
};
StringBuffer.prototype.setLength = function(nLen) {
if('undefined' == typeof(nLen) || 0 >= nLen) {
this._aString.length = 0;
} else {
this._aString.length = nLen;
}
};