[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

String Ranges

T. Onoma

11/7/2004 1:06:00 PM

I wonder if any one has ever noticed the "order" discrepancy that exists
between String#<=> and String#succ. One consequence:

irb(main):001:0> a = 'a'..'b'
=> "a".."b"
irb(main):002:0> a.include?('aa')
=> true

Also I'd like to know what others are doing with string ranges. If you've used
a string range in a serious way I'd like to know how --I'm trying to get a
impression of their over all usability.

Thanks,
T.


3 Answers

dblack

11/7/2004 1:51:00 PM

0

Dave Burt

11/9/2004 1:44:00 AM

0

> I've mainly used them for:
>
> ('a'..'z').to_a
>
> and similar things.

I've don't think I've used them without the .to_a suffix.

Cheers,
Dave


Logan Capaldo

11/9/2004 3:13:00 AM

0

Ever once in a while I'll do a ('a'..'z').each { } type dealie, can't
remember why at the moment. (Of course this can be achieved with
to_a.each { } to)

On Tue, 9 Nov 2004 10:48:33 +0900, Dave Burt <burtdav@hotmail.com> wrote:
> > I've mainly used them for:
> >
> > ('a'..'z').to_a
> >
> > and similar things.
>
> I've don't think I've used them without the .to_a suffix.
>
> Cheers,
> Dave
>
>