function StringBuilder() {
    this.__strings__ = new Array;

    if (typeof StringBuilder._initialized == "undefined") {
        StringBuilder.prototype.append = function (str) {
            this.__strings__.push(str);
        };

        StringBuilder.prototype.prvAppend = function (str) {
            this.__strings__.unshift(str);
        };

        StringBuilder.prototype.tostring = function () {
            return this.__strings__.join("");
        };
        StringBuilder._initialized = true;
    }
}
String.prototype.format = function () {
    var args = arguments;
    return this.replace(/\{(\d+)\}/g,
        function (m, i) {
            return args[i];
        });
}
String.format = function () {
    if (arguments.length == 0)
        return null;

    var str = arguments[0];
    for (var i = 1; i < arguments.length; i++) {
        var re = new RegExp('\\{' + (i - 1) + '\\}', 'gm');
        str = str.replace(re, arguments[i]);
    }
    return str;
}
