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:
$$$:~$ perl -e '@x=split(/ /, ""); $s=@x;print "$s\n"'
0
Python:
$$$:~$ python -c 'list="".split();l=len(list);print(l)'
0
No comments:
Post a Comment