ruby on rails - RoR array -count identical elements-on including value -


how count idential values on after appending value in array

such that

a=[]  a<<1 count of 1 1  a<<1 count of 1 2 

thanks

you do:

a.select{|v| v == 1}.size 

it's 1 solution


Comments

Popular posts from this blog

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

xslt - Umbraco and EXSLT sets do not work -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -