//StringBuilder.js - by matthew reynolds
//created: Feb 02 2009
//
//a simple string library

// StringBuilder
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("");
};