Really, pretty much what the title says.
Say you have this string:
var theString = \"a=b=c=d\";
Now, when you run theString
I'd use something like this:
function JavaSplit(string,separator,n) {
var split = string.split(separator);
if (split.length <= n)
return split;
var out = split.slice(0,n-1);
out.push(split.slice(n-1).join(separator));
return out;
}
What we're doing here is:
One might reasonably think you could chain all of those calls together, but .push() mutates an array rather than returning a new one. It's also a bit easier for you to follow this way.