The limit parameter controls the number of times the regular expression pattern is applied for splitting the subject string. It affects the length of the resulting array with the following rules:
- If the limit is greater than 0, then the pattern will be applied at most one time, the resulting array's length will not be greater than the limit, and the array's last entry will contain all input substrings beyond the last matched delimiter.
- If the limit is negative, then the pattern will be applied as many times as possible, and the resulting array can have any length.
- If the limit is zero (as in the single parameter split method call), then the pattern will be applied as many times as possible, the array can have any ...