James Edward Gray II wrote:
> On Oct 4, 2006, at 8:19 AM, Peter Szinek wrote:
>
> > Hello,
> >
> > Sorry for the lame question again, but even after a lot of googling
> > I still couldn't find the $subj., ie. something like:
> >
> > >>> "asdfghj"[2::2]
> > 'dgj'
> > (= every second letter, beginning from the 2nd index in the string)

Interesting, though I'm surprised Python has explicit syntax for what
seems like a highly specific type of operation.  But, hey, cool.

> I'm not going to call this as pretty, of course, but:
>
>  >> test = "asdfghj"
> => "asdfghj"
>  >> test[2..-1].gsub(/(.)./, "\\1")
> => "dgj"

Slightly OT here....

I'm trying to remember why test[2, -1] returns nil.  Positive numbers
for the second integer work as expected:

test[2,1] => 'd'
test[2,2] => 'df'
test[2,100] => dfghj
test[2,-1] => nil

/me considers a patch to string.c

Regards,

Dan