Adds a format provider.

StringFormat.addFormatProvider(function(ctx) {    
    var toStringSafe = function() { 
        return ctx.value ? ctx.value.toString() : "";
    };

    if (ctx.expression === "upper") {
        // UPPER case
        ctx.handled = true;
        return toStringSafe().toUpperCase();
    }

    if (ctx.expression === "lower") {
        // LOWER case
        ctx.handled = true;
        return toStringSafe().toLowerCase();
    }
});

Use provider

// MARCEL kloubert
var newStr = StringFormat.format("{0:upper} {1:lower}",
                                 "Marcel", "KlOUBERT");