Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String split based on repetitions

Tags:

I have a string value ("11112233"). I want to split this string and separate it to 3 different value.

Val 1 = 1111
val 2 = 22    
val 3 = 33

I searched a lot, its possible with characters like (/) or other symbols. Something else, My number is always different, so i cant split it by enter the exact string. I want to do something like this:

var myVal = "11112233";
var lastVal = myVal.split(0 , 3); // split from index 0 till index 3

How i can do it?
Thanks