I am newbie on Ruby. I got a (newbie’s) question on my study:
(‘a’…‘zz’).to_a
we got [‘a’, … ‘z’, ‘aa’ … etc till … ‘zz’ ]
It seems the sequence is like ‘a’, ‘b’, …‘z’, ‘aa’, … ‘zz’
Now if I want an Range object contents like:
‘a’, ‘b’, …‘z’, 'aa’
If I write like:
(‘a’…‘aa’).to_a # Ooops, I got only [‘a’]
that is because: ‘a’.next == ‘b’ which > ‘aa’
This is a little bit strange for me, in one side, we saw the real sequence
(‘a’ to ‘zz’), but if we try take a sub sequence (‘a’ …‘aa’) from it, it fail…
Is this normal? (BTW: sub sequence of an integer interval do not have this problem)
If my understanding is correct, that is because ‘a’.next > ‘aa’;
how can you construct an Range (‘a’, ‘b’, …‘z’, ‘aa’) in the simplest way?
Thanks.
···
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
–
The problems of business administration in general and data base
management in particular are much too difficult for people that think in
IBMerese, compounded with sloppy English.
– Edsger Dijkstra, How do we tell truths that might hurt?
–
Were it left to me to decide whether we should have government without
newspapers or newspapers without government, I should not hesitate for a
moment to prefer the latter. But I should mean that every man should
receive those papers and be capable of reading them.
– Thomas Jefferson