Apply a formatting function
function applyFormat(method, args, string) {

        // Parse a string like "1, 2, false, 'test'"
        var m, pos = 0;
        while ((m = string.substring(pos).match(argsExp))) {
            // number
            args.push(m[2] ? +m[2]
                           // boolean
                           : (m[1] ? m[1] === 'true'
                                   // string
                                   : m[4].replace(quotesExp[m[3]], m[3])));

            pos += m[0].length;
        }

        return method.apply(null, args);

    }