Comparing the items within a collection of string

So I have a string collection


and it contains something like this

myString(0) = "a" myString(1) = "b" myString(2) = "b" myString(3) = "c" myString(4) = "a" 

I am trying to think of the simplest way I can out put to a RTB something like the following

A = 2 B = 2 C = 1 

Now I know I could do it if I knew it was only A B and C; but I need it to represent any possible value for myStrings; names, dates, values, things like that.

Right now i’m thinking of multiple lists, or arrays, and comparing. But Id rather not do in 300 lines of code what might be doable in 10.

Any thoughts or suggestions?

This is something i’ve been adding to a sales program I have been working on. The goal being that every time an item is sold, it will record it and note it somewhere, so at the end of the day you can tell just how many of any given thing has been sold.

submitted by /u/CityEggs
[link] [comments]

Leave a Reply