What should ",7-6-5-4-3-2-1,".split(',')
return?
It seems to return
blank string
7-6-5-4-3-2-1
ie. two strings. I'd expect either one or three strings - that is a blank string at both ends or just the string between ','s.
Am I wrong? Is there a good explanation for the current behaviour?
EDIT:
OK. So yes, I had the wrong expectation and no, there is no good explanation other than Java works that way :). Thanks.
EDIT2:
You can get the desired behaviour with split(",", -1)
(Scala 2.8.1)
s.split(",", -1)
– Scriabin