Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
count the total numbec#r of specified characters in a url using windows form c#
Posted
Comments
Maciej Los 19-Apr-13 4:25am    
What kind of "specified characters"?
Please, be more specific and provide more details.
Maciej Los 19-Apr-13 4:31am    
Please, do not repost!
http://www.codeproject.com/Questions/580336/specialpluscharacterspluscountplusinplusaplusurlpl
Remove this post!

C#
string str="@@##$$";

int count = str.Where(p=>p=='@').Count();
 
Share this answer
 
v2
int count = 0;
string st = "Hi,Here you can place your Browser Address Also or any string from which you want to count of a char occurence.";
foreach(char c in st) {
if(char.IsLetter(c)) {
count++;
}
}
lblResult.Text = count.ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900