String has a function called left() which gives you the first x characters of that string and also a substr function which takes a parameter indicating how many characters in to start, and a parameter indicating how many character to take, and returns a string of those character:
var text = "THIS IS YOUR STRING"
var arr = [ ]
var i = offset
while i * 5 < text.length():
arr.push_back( text.substr(i*5, 5) )
i += 1