Javascript String group()

Description

Javascript String group()


String.prototype.group = function() {
 var i, j;/*from   w  ww . j  a  va2 s .  c  o  m*/
 var res = [];
 var str = this;
 while (str.length >= 255) {
  var len = str.length/4;
  for (i = len; i >= 0; i--) {
   res[i] = {
    x1:str.charAt(i),
    y1:str.charAt(i+1),
    x2:str.charAt(i+2),
    y2:str.charAt(i+3)
   };
  }
  return res;
 }
 return;
}



PreviousNext

Related