会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
Fengzhimei@Dot.Net
Designing My Colorful Dream
博客园
首页
博问
闪存
新随笔
订阅
管理
StringBuilder in Javascript
function
StringBuilder()
{
this
.buffer
=
new
Array();
}
StringBuilder.prototype.Append
=
function
Append(string)
{
if
((string
==
null
)
||
(
typeof
(string)
==
'undefined'))
return
;
if
((
typeof
(string)
==
'string')
&&
(string.length
==
0
))
return
;
this
.buffer.push(string);
}
;
StringBuilder.prototype.AppendLine
=
function
AppendLine(string)
{
this
.Append(string);
this
.buffer.push(
"
\r\n
"
);
}
;
StringBuilder.prototype.Clear
=
function
Clear()
{
if
(
this
.buffer.length
>
0
)
{
this
.buffer.splice(
0
,
this
.buffer.length);
}
}
StringBuilder.prototype.IsEmpty
=
function
IsEmpty()
{
return
(
this
.buffer.length
==
0
);
}
StringBuilder.prototype.ToString
=
function
ToString()
{
return
this
.buffer.join(
""
);
}
;
posted on
2006-05-16 23:39
fengzhimei
阅读(
968
) 评论(
1
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部