Links

Search This Blog

March 13, 2022

Split on Nth place

For those who stumble on this.

Translated from Python to JavaScript.
 

function nthsplit(line,n){
var i;
var arr = [];
  for(i=0;i<line.length;i+=n){
   arr.push(line.substring(i,i+n));
  }
  return arr;
}

 

Code originally found on StackOverFlow posted by Satomacoto

No comments:

Post a Comment