Link to home
Start Free TrialLog in
Avatar of pr_wainwright
pr_wainwright

asked on

Looping StringBuilder strings

Hi,
    I have a C# StringBuilder with the below strings:

2.1.1 ICSS
2.1.1 ICSS
2.1.1 ICSS
2.1.4 User Interface
2.1.4 User Interface  
2.1.5 Alarm Management  
2.1.5 Alarm Management  
2.1.5 Alarm Management  
2.1.5 Alarm Management

How can I loop through these strings & count the total of each type. e.g. The results would be:
2.1.1. ICSS = 3
2.1.4 User Interface = 2
2.1.5 Alarm management = 4

Thanks
Paul.
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

How are they delimited?

Regardless, use a HashTable type structure and add a counter variable to it using the strings as the key.  If the key already exists then increment the value already stored there.

What version C# are you using?
Avatar of pr_wainwright
pr_wainwright

ASKER

Idle_Mind,
                I am using Visual Web Developer 2005. I have never used hash tables before. Any help on these appreciated.

Thanks
Paul.
How are the strings delimited in the StringBuilder?....are they separated by comma, tab, something else?....
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Exactly what I needed. Thanks.