I have an array that contains the following:
114,151,157,151,10,12,14,151,157,10
I need to count how many instances of each item show up in this string. In this case:
114 shows up 1 time 151 shows up 3 times 157 shows up 2 times 10 shows up 2 times 12 shows up 1 time 14 shows up 1 time
From there I need to match it back up so I can define this in an orderly fashion. Ala:
counted151 = "3", counted157 = "2", counted10 = "2", counted114 = "1", counted14 = "1", counted12 = "1",
If you haven't guessed by now this only my 12th hour using RoR, so the code that I have so far simply creates the array and does a .length method for a count variable. I have a feeling this job requires array.map and I've been playing around with that method but I still cant be certain as to how to implement it. Any tips or ideas would be greatly appreciated. In the meantime I'll keep at it.