复制代码 代码如下:
复制代码
function StringBuffer(){
this.__strings__ = new Array();
}
StringBuffer.prototype.append = function(str){
this.__strings__.push(str);
};
StringBuffer.prototype.toString = function(){
this.__strings__.join(" ");
};
function StringBuffer(){
this.__strings__ = new Array();
}
StringBuffer.prototype.append = function(str){
this.__strings__.push(str);
};
StringBuffer.prototype.toString = function(){
this.__strings__.join(" ");
};
其实上面的代码,主要利用了js的数组原理实现。
最后
以上就是矮小小兔子最近收集整理的关于javascript下高性能字符串连接StringBuffer类的全部内容,更多相关javascript下高性能字符串连接StringBuffer类内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复