﻿String.format = function(format) {
    var args = arguments;

    return format.replace(/\{(\d*)\}/gm, getArg);

    function getArg(match, index, startPosition) {
        if (!isNaN(index)) {
            index = (index * 1) + 1;
            if (index < args.length) return args[index];
        }

        return match;
    }
}

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}