Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails array count occurrences of elements

names.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #array #count #occurrences #elements
ADD COMMENT
Topic
Name
3+1 =