X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!talisker.lacave.net!lacave.net!not-for-mail From: 7stud -- Newsgroups: comp.lang.ruby Subject: Re: string/array slices Date: Wed, 30 Mar 2011 13:08:05 -0500 Organization: Service de news de lacave.net Lines: 27 Message-ID: References: <303f109bd62c19b354717039ac8af1a8@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1301508954 11397 65.111.164.187 (30 Mar 2011 18:15:54 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Wed, 30 Mar 2011 18:15:54 +0000 (UTC) In-Reply-To: <303f109bd62c19b354717039ac8af1a8@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 380625 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:1982 Patrick Tyler wrote in post #990031: > Hello, > > I know that this has been covered a bit here: > http://www.ruby-forum.com/topic/186437 but I'm still not certain that I > understand. > > s = "foo" > > s[3] is nil, like I would expect. > > s[3,0] is "", instead of nil. That behaviour is contrary to the description in the 1.9.2 docs here: http://www.ruby-doc.org/core/classes/Array.html which say: Returns nil if the index (or starting index) are out of range. Because 3 is out of range, s[3,0] should return nil according to the docs. -- Posted via http://www.ruby-forum.com/.