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.
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
I think that I've seen examples like this brought up occasionally:
irb(main):007:0> 'z'.succ > 'z'
=> false
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.
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.