Forum: Ruby Re: string range membership

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1c1e3bdfe006a22214102fcd6434a012?d=identicon&s=25 daniels (Guest)
on 2005-11-23 23:54
(Received via mailing list)
ruby -e "p ('1'..'10').find {|x| x == '2'}"
"2"

It wont be as fast as Range#include, but you can't put the equivalent
into Range without giving it knowledge about how String#succ works.
#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################
This topic is locked and can not be replied to.