There isn't a built-in function for that. You can easily do it like this.
[tt]
var s="So ¬this is an ¬ example of the ¬ string to ¬ split";
var sig="¬"; //signature
var seg=2; //segment length
var sep; //separator-delimitor
var a=s.split(sig);
var aa=new Array(); //holding resultant array
for (var i=0;i<Math.floor(a.length/seg);i++) {
sep="";
aa="";
for (var j=0;j<seg;j++) {
aa+=sep+a[i*seg+j];
sep=sig;
}
}
if (a.length%seg) {
sep="";
var idx=aa.length;
aa[idx]="";
for (var i=0;i<a.length%seg;i++) {
aa[idx]+=sep+a[Math.floor(a.length/seg)*seg+i];
sep=sig;
}
}
//can return aa if set up as a function
[/tt]
It is in a form readily made into a function and sufficiently general.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.