
On Wed, 13 Jul 2005 23:08:19 +0200, Pavol Droba <droba@topmail.sk> wrote:
Hi,
This is an interesting observation. So it seems reasonable to drop back to 1.32 version.
The only reasonable thing is for split to return N+1 pieces for a string with N separators, if you ask me. :-) This is lossless in the sense that it allows you to reconstruct the original string. The non-reasonable behavior can easily be implemented on top of that, but not vice versa.
Reading your replies and thinking about it a little bit, I come to conclusion, that the definition above is realy to only reasonable one. That was actualy also the reason why I have altered the behaviour in this release. Beacuse I considered the former one as wrong.
But now there is still issue about the empty string. I think, that both approaches - returning no token - returing one empty token
have some meaning.
The second one is very similar to returnig an empty token at the end if the input string ends with a separator.
The first one simply tells that nothing equals nothing. Yet I prefer the second approach, since it is more on par with the current reasoning.
Does anybody have some arguments/reasoning that can help here?
I agree that both have some meaning, but like you, I also prefer the second approach. I think Peter brings up a good point when he says that split should return N+1 pieces for a string with N separators. I feel the same way about this, so I vote that you don't change anything. -- Be seeing you.