------art_6847_31184264.1177895964792
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,
Harry, thanks :D


On 4/30/07, Harry <list.push / gmail.com> wrote:
>
> On 4/29/07, Billy Hsu <ruby.maillist / gmail.com> wrote:
> > Thanks for your reply, I learned more on this thread :P
> > But I have a question:
> > If I have an array contain:
> >   ary  1, 12, 234, "456"]
> > there has two elements which size is 3, but the longest method just
> returned
> > one of them.
> > I can't solve it :(
> >
>
> Is this what you are looking for?
> Do you want all longest elements?
>
> big  1, 12, 234,45,978, "456"].max {|x,y| x.to_s.size <y.to_s.size}
> p [1, 12, 234,45,978, "456"].select {|r| r.to_s.size big.to_s.size}
>
> Harry
>
> --
> http://www.kakueki.com/ruby/list.html
> A Look into Japanese Ruby List in English
>
>


-- 
Taiwan Ruby Users Group:
http://www.ruby.oss.tw/
http://www.ruby.oss.tw/phpbb

------art_6847_31184264.1177895964792--