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("");} ; 转载于:https://www.cnblogs.com/fengzhimei/archive/2006/05/16/402021.html