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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -