javascript - How to split the string in to different parts -


i want split string in different parts. have string generated dynamically contains 500 characters. want split in 5 parts. mean want take 100 characters in array[0], next 100 characters in array[1] ....

example:

 var string = "kjfaorj.......................................................";  array[0] = "kjfaorj..... 100 characters";  array[1] = " next 100 characters ";  ..........................  .......................... 

 if(str.length % 100 == 0) //if string contains 500 or 400...etc      count = str.length / 100;   else     count = str.length / 100 +1; //if string contains 505 or 417...etc  for(var i=0;i<count;i++)   array[i] = s.substring(i*100,(i*100)+(100)); 

second approach dynamic string


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -