Friday, June 10, 2011

Java splitting an empty string

Splitting an empty string results in an array whose single element is an empty string - not intuitive. The expected result is either a null array or a zero-length array.


$$$:~$ perl -e '@x=split(/ /, ""); $s=@x;print "$s\n"'

$$$:~$ python -c 'list="".split();l=len(list);print(l)'

1 comment:

Blogger said...

If you need your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (no matter why you broke up) you must watch this video
right away...

(VIDEO) Text Your Ex Back?