![]() |
Counting Number of Letters in a String
Hi,
I'm trying to count the number of letters in a string. e.g. I want to know how many e's there would be in string1 or t's there would be in string2 I was going to display them in a datagrid but abandoned that idea and now want to display them as individual integers so how many e's there are would be something like intE. Thanks! mattireland |
Re: Counting Number of Letters in a String
Iterate through the string character by character and count the occurrences of each letter :)
|
Re: Counting Number of Letters in a String
|
Re: Counting Number of Letters in a String
irrelevant reply and no way to delete post any longer.
|
Re: Counting Number of Letters in a String
This is an easy way to do it in C#. I'm sure .NET has easier built in functions though. All you'll have to do is convert it over, but for the most part it's the same.
:
|
Re: Counting Number of Letters in a String
Thanks very much guys! Especially to IR and Booze (IR I used that link and found loads of other good stuff on there - thanks! Booze thanks for that I used it in a C# variation that I was doing). I was waiting until I had the program finished before I replied to this thread so you could see what I've done with it but alas, I've not quite finished it yet.
Thanks again, Matt. |
Re: Counting Number of Letters in a String
just out of interest what is the purpose of this program?
|
Re: Counting Number of Letters in a String
of course .net has easier built in functions:
:
|
Re: Counting Number of Letters in a String
Thanks.
@ knetcozd: Cipher cracking. |
Re: Counting Number of Letters in a String
Quote:
|
| All times are GMT -5. The time now is 3:35 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC