OK - its getting late and my solutions are getting weerd.
In my program, a number of int values are added to a string
String output;
int value;
stuff happens
output += "*" + value;
In the end I would like to take this string and seperate out how many occurences of each int value there was, and presumably print this out.
Idealy, a string like *1*11*22
should be processed as having
"1 occurence of 1,
1 occurence of 11
1 occurence of 22"
The only way I can figure out just tells me how many occurences of each individual digit there is, so it would take the string *1*11*22 and tell me there were three 1's and two 2's in the string.
(I basically used a for loop to loop through all the characters in the string and check how many times each one occurs. But obviously that does not give me how many times each number occurs. )
What am I missing here?
In my program, a number of int values are added to a string
String output;
int value;
stuff happens
output += "*" + value;
In the end I would like to take this string and seperate out how many occurences of each int value there was, and presumably print this out.
Idealy, a string like *1*11*22
should be processed as having
"1 occurence of 1,
1 occurence of 11
1 occurence of 22"
The only way I can figure out just tells me how many occurences of each individual digit there is, so it would take the string *1*11*22 and tell me there were three 1's and two 2's in the string.
(I basically used a for loop to loop through all the characters in the string and check how many times each one occurs. But obviously that does not give me how many times each number occurs. )
What am I missing here?