-
Junior Member
Using Collection
Using Collection Please tell me the code for the following
Hi
I have some number of strings and I want to calculate number of times a particular String appears.
eg.
Suppose I have 10 Strings
String s1="Ram";
String s2="Sham";
String s3="Ram";
String s4="Sham";
String s5="Sham";
String s6="Sham";
String s7="Ram";
String s8="Ram";
String s9="Sham";
String s10="Ram";
I want to calculate how many times Ram and Sham appears.
Please revert me soon
-
Contributing Member
Re: Using Collection
Hi Gaurav0252,
What you can do is to store all these Strings in an Array.
Loop through the array comparing every element with every other element. You could also declare an integer array where you will store the count.
Regards,
Sahil.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules