in reply to Split the array elements in ranges

Check this out Get ranges from a list of numbers (like 1,2,3 => 1-3)