[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: String#index/include limitation in number of characters

seebs

5/18/2007 9:35:00 PM

In message <ac257f8491787a98f4f606a8d556861d@ruby-forum.com>, Eu Fe writes:
>Do you understand why the last include gives false ?? It seems that the
>limit is 24 characters, is it a bug ?

I don't think the limit is 24 characters.

>irb(main):001:0>
>s="asdfasdfasdfasdfasdfppppppppppppppppppppppppasdfasdf"
>=> "asdfasdfasdfasdfasdfppppppppppppppppppppppppasdfasdf"
>irb(main):002:0> s1="pppppppppppppppppppppppp"
>=> "pppppppppppppppppppppppp"
>irb(main):003:0> s.include?(s1)
>=> true
>irb(main):004:0> s1="ppppppppppppppppppppppppasdf"
>=> "ppppppppppppppppppppppppasdf"
>irb(main):005:0> s.include?(s1)
>=> false

I cannot reproduce this. I cut and paste it:

irb(main):007:0> s="asdfasdfasdfasdfasdfppppppppppppppppppppppppasdfasdf"
=> "asdfasdfasdfasdfasdfppppppppppppppppppppppppasdfasdf"
irb(main):008:0> s1="ppppppppppppppppppppppppasdf"
=> "ppppppppppppppppppppppppasdf"
irb(main):009:0> s.include?(s1)
=> true

-s

4 Answers

Eu Fe

5/18/2007 9:47:00 PM

0

Maybe my platform or interpreter ??? That's really weird:
irb 0.9(02/07/03)
Linux 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT 2006 x86_64 x86_64
x86_64 GNU/Linux



--
Posted via http://www.ruby-....

Eu Fe

5/18/2007 9:47:00 PM

0



ruby 1.8.1 (2003-12-25) [x86_64-linux-gnu]

--
Posted via http://www.ruby-....

Eu Fe

5/18/2007 10:04:00 PM

0

OK I upgraded to ruby 1.8.6 with irb 9.5 it solves the problem.

It seems to be a bug in the previous version !


--
Posted via http://www.ruby-....

Brian Candler

5/19/2007 12:53:00 PM

0

On Sat, May 19, 2007 at 07:03:50AM +0900, Eu Fe wrote:
> OK I upgraded to ruby 1.8.6 with irb 9.5 it solves the problem.
>
> It seems to be a bug in the previous version !

Yep, don't use the one which comes with Red Hat/CentOS. It breaks with all
sorts of things.

There's a 1.8.5 pre-built package in the CentOS 'testing' directory which
works well.

Regards,

Brian.