code: function formatArray(formatStr, args) {
      if (!formatStr) {
          return formatStr;
      }
      if (!args) {
          args = [];
      }
      return formatStr.replace(/{(\d+)(\:)?([^}]*)}/g, function (match, index, formatSeparator, formatExpr) {
          var resultValue = args[index];
          if (resultValue === undefined) {
              return match;
          }
          var funcDepth = 0;
          while (typeof resultValue === "function") {
              resultValue = resultValue(index, args, match, formatExpr, funcDepth++);
          }
          if (formatSeparator === ':') {
              // use format providers
              for (var i = 0; i < _formatProviders.length; i++) {
                  var fp = _formatProviders[i];
                  var fpCtx = new FormatProviderContext(formatExpr, resultValue);
                  var fpResult;
                  try {
                      fpResult = fp(fpCtx);
                  }
                  catch (e) {
                      continue;
                  }
                  if (fpCtx.handled) {
                      // handled: first wins
                      resultValue = fpResult;
                      break;
                  }
              }
          }
          if (resultValue !== undefined) {
              return resultValue;
          }
          // not defined => return whole match string
          return match;
      });
  }
docs: Formats a string.
  
  @function formatArray
  
  @param {String} formatStr The format string.
  @param {Array} args The list of arguments for the format string.
  
  @return {String} The formatted string.