Originally posted by Jaime Tovar:
You only get 8 Strings because there is no String to get between “^^”.
The problem is not that they're contiguous, it's that they're at the end of the string; split() ignores trailing empty fields by default. To override that behavior, use the two-argument form of split with -1 as second argument:
That will give you an array of length 10 in which the last two elements are empty strings. Be aware that 10, not 9, is the number you'll get by iterating over the array, which is unnecssary anyway. If you really want to know how many separators there are, all you have to do is subtract 1 from the array's length: