DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
9+1 =
Submit