This is a good approach but you may want to look at the optional argument you can pass split to set the maximum length of the resulting array as an alternative approach.