﻿String.format = function(text)
{
    //Verificar si existen mas de un argumento...
    if (arguments.length <= 1)
    {
        //Cuando  no existen dos argumentos entonces se retorna el texto original 
        return text;
    }
    //decrement to move to the second argument in the array
    var tokenCount = arguments.length - 2;
    for( var token = 0; token <= tokenCount; token++ )
    {
        //iterate through the tokens and replace their placeholders from the original text in order
        text = text.replace( new RegExp( "\\{" + token + "\\}", "gi" ),
                                                arguments[ token + 1 ]);
    }
    return text;
};