From: dblack@... Date: 2006-01-14T20:15:16+09:00 Subject: Re: Range#member? Oddity Hi -- On Sat, 14 Jan 2006, Christer Nilsson wrote: > Hal Fulton wrote: >> James Edward Gray II wrote: >>> => false >> In short: Don't do this. >> >> String ranges are very weird. They don't obey the rule that >> x.succ > x. >> >> Since "2" > "10", "2" is considered outside the range entirely. >> >> If you really want to do this kind of thing, say >> ("1".."10").to_a.member?("2") >> >> >> Hal > > If the two strings have the same length, the weirdness disappears. But other weirdnesses arise :-) irb(main):019:0> ("A".."z").member?("g") => true irb(main):020:0> ("A".."z").to_a.include?("g") => false David -- David A. Black dblack@wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black