I'm aware that the API documentation matches the

results, however I can't see the logic of it. Why does

it split "22" in the first example into two

zero-length strings, but doesn't in the second?

The input is broken up into tokens that are delimited on each side by one of the following:

1) the beginning of the input

2) a subsequence that matches the pattern

3) the end of the input

When you give a negative number as the limit parameter, the split method will return the MAXIMUM number of tokens that it can produce from the input String.

Lets list all of the delimiters in the input:

1) The begging of the input (^)

2) The first occurance of '2' (2-1)

3) The second occurance of '2' (2-2)

4) The end of the input ($)

So, 4 delimiters means 3 tokens. Lets list what the tokens are for each input String your gave an example of:

Example "122"

from ^ to 2-1 gives "1"

from 2-1 to 2-2 gives ""

from 2-2 to $ gives ""

Example "1223"

from ^ to 2-1 gives "1"

from 2-1 to 2-2 gives ""

from 2-2 to $ gives "3"

Does this help at all?