'script'에 해당되는 글 1건

  1. 2007.12.17 javascript -> StringBuffer

JavaScript StringBuffer

function StringBuffer() { this.buffer = []; }

StringBuffer.prototype.append = function(string)
{
this.buffer.push(string);
return this;
}

StringBuffer.prototype.toString = function()
{
return this.buffer.join("");
}

To use it:
var s = new StringBuffer();
s.append("Hello, ").append(" World!");
alert(s.toString());
link:
http://www.multitask.com.au/people/dion/archives/000354.html
 
Posted by stekilove
,