JavaScript simulate StringBuilder
九月 29, 2008 Posted in RSS 觀看文章來源
參考了code project其中有一篇關於javascript模擬StringBuilder的作法
function StringBuilder(value) {
this.strings = new Array(”");
this.Append(value);
}
StringBuilder.prototype.Append = function(value) {
if (value) {
this.strings.push(value);
}
return this; /* chain capability */
}
StringBuilder.prototype.Clear = function () {
this.strings.length = 1;
}
StringBuilder.prototype.ToString = function() {
return this.strings.join(”");
}
讀過本文的讀者, 也對以下文章有興趣
jhihguan: graduate
KCLee: @OSU, 好冷 …
Odd: PhD Life 週記2
KCLee: @OSU, 新的一週開始啦
huge: hello world again
No comments for this entry yet...























