js实现C#的StringBuilder效果完整实例
发布时间:2020-12-15 04:58:23 所属栏目:百科 来源:网络整理
导读:本篇章节讲解js实现C#的StringBuilder效果。供大家参考研究具体如下: s.length){h[0]=s;} else { h[0]=s.substring(0,startIndex); h[1]=s.substring(startIndex+length,s.length); } return this; } // Inserts the string representation of a
本篇章节讲解js实现C#的StringBuilder效果。分享给大家供大家参考,具体如下: s.length){h[0]=s;}
else
{
h[0]=s.substring(0,startIndex);
h[1]=s.substring(startIndex+length,s.length);
}
return this;
}
// Inserts the string representation of a specified object into this instance at a specified character position.
// Parameter["index"] - The position at which to insert.
// Parameter["value"] - The string to insert.
// Return Value - A reference to this instance after the insert operation has occurred.
function Insert(index,value)
{
var s = h.join('');
h = new Array();
if(index<1){h[0]=value; h[1]=s;}
if(index>=s.length){h[0]=s; h[1]=value;}
else
{
h[0]=s.substring(0,index);
h[1]=value;
h[2]=s.substring(index,s.length);
}
return this;
}
// Gets the type
function GetType()
{
return "StringBuilder";
}
};
希望本文所述对大家JavaScript程序设计有所帮助。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |