高效的Javascript 字符串操作类

/**************************************************
* * 字符串操作类
* * 2008-7-25
* **************************************************
* * msn:[email protected]
* * author:淡新举
***************************************************/
var StringBuilder = function(){
this.arr = new Array();
};

//追加字符串
StringBuilder.prototype.add = function(item){
this.arr.push(item);
};

//清空字符
StringBuilder.prototype.clear = function(){
this.arr.length = 0;
};

//转换为String
StringBuilder.prototype.toString = function(){
return this.arr.join("");
};

你可能感兴趣的:(JavaScript)