When you call the split function with only one argument ,then it assumes that the second argument of the split function is zero. And when the second argument is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded. This is the reason why you are not seeing the trailing empty strings.