The limit parameter rules

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:

  1. 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.
  2. If the limit is negative, then the pattern will be applied as many times as possible, and the resulting array can have any length.
  3. 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 length, and trailing empty strings will be discarded.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.172.56