Hi

I need to count variations within a certain field from a text file which I read in.

Basically, file is read.
String is split based on the delimiter and read into an array
String(2) is the element which I need to count variations
String(1) is the number by which I need to increment the count by

Example

Data read in contains

1,apple
2,oranges
1,apple
1,pear
5,oranges

So I need to create a two dimensional array to hold the information

Somehow I need to end up with an array which has the following values

Apple,2
Oranges,7
Pear,1

How would be the best way to achieve this?

I saw an example somewhere of doing exactly this using 2d arrays a few months ago but can't find it now!

Kind regards

S