Skip to content

Instantly share code, notes, and snippets.

@very
Created November 3, 2012 00:08
Show Gist options
  • Save very/4005163 to your computer and use it in GitHub Desktop.
Save very/4005163 to your computer and use it in GitHub Desktop.
splitAt
function splitAt(string, index1, index2, etc) {
var parts = Array.prototype.slice.call(arguments);
parts[0] = 0;
for (var i = 0, l = parts.length; i < l; i++) {
parts[i] = string.substring(parts[i], parts[i + 1]);
}
return parts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment