On Mon, Feb 27, 2012 at 2:04 PM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
> Hi, does anyone know how to compare to arrays not considering their order?
> if I compare [1, 4, 2] with [4, 1, 2], this should return true.
ruby-1.9.2-p290 :004 > [4,1,2] == [1,4,2]
=> false
ruby-1.9.2-p290 :005 > [4,1,2].sort == [1,4,2].sort
=> true
Like that?
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment