>>>>> "Ernest" == Ernest Ellingson <erne / powernav.com> writes:
Ernest> At 03:27 2/18/2001 +0900, you wrote:
>> a = "FooBar"
>> b = a.split(//)
>> b[6,2] #=> []
>> a[6,2] #=> nil
>>
>> anyone knows why this last one returns nil instead of "" (empty string) ?
Ernest> a[6] doesn't exist thus a[6,2] doesn't exist, thus Ruby
Ernest> says "Ain't no such thing"
b[6] doesn't exist either. Yet b[6,2] returns an empty string.
--
-- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)