Javascript String rsplit(sep, maxsplit)

Description

Javascript String rsplit(sep, maxsplit)


String.prototype.rsplit = function(sep, maxsplit) {
  var split = this.split(sep);
  return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].concat(split.slice(-maxsplit)) : split;
};



PreviousNext

Related