﻿
String.prototype.format = function() {
    var s = this,
        i = arguments.length;

    while (i--) {
        s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
    }
    return s;
};

String.prototype.trim = function(arg) {
    var s = this;

    if (s.length > 0) {
        if (s.charAt(s.length - 1) == arg) {
            s = s.substring(0, s.length - 1);
        }
    }

    if (s.length > 0) {
        if (s.charAt(0) == arg) {;
            s = s.substring(1, s.length);
        }
    }

    return s;
};


