Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

how to group array in ruby

list.group_by(&:capitalize).map {|k,v| [k, v.length]}
#=> [["Master of puppets", 3], ["Enter sandman", 2], ["Nothing else matters", 1]]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #group #array #ruby
ADD COMMENT
Topic
Name
4+5 =