String#index/include limitation in number of characters

E

Eu Fe

Do you understand why the last include gives false ?? It seems that the
limit is 24 characters, is it a bug ?

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
 
B

Brian Candler

Do you understand why the last include gives false ?? It seems that the
limit is 24 characters, is it a bug ?

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 get 'true' in both cases. I am using the package supplied with Ubuntu
Linux 6.06, which gives RUBY_VERSION as 1.8.4

What platform and ruby version are you using?
 
E

Eu Fe

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
 
E

Eu Fe

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 !
 
B

Brian Candler

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top